Solved

Convert VB6 "Drawing Styles" to .Net

Posted on 2008-06-23
11
1,719 Views
Last Modified: 2013-11-26
Does anyone know where I can find some sort of list that would match VB6 "ScaleMode", "DrawWidth", and "DrawStyle" to an equivalent usage in VB.Net?
0
Comment
Question by:CKirby18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21849165
1) I don't know of any list, per se.

2) It has been a while since I have used VB6.

3) How would you use those VB6 constructs?
0
 

Author Comment

by:CKirby18
ID: 21849290
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21849327
Without really digging through all that code, explain what it does for you.  Are you do something like drawing an image on a PictureBox, and then using scroll bars to scroll the image that is larger than the form?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:CKirby18
ID: 21849758
I am having to convert someone else's VB6 code to VB.Net.  Their code was used to do what you described.  However, I am unfamiliar with VB6, so I do not know exactly what impact  "ScaleMode", "DrawWidth", and "DrawStyle" had when he called the "Line" and "Print" procedures.  In .Net I am using "DrawLine" on a panel to display the graph.  I am trying make the .Net graph match the original graph as much as possible.  Therefore, I needed to know if there was an equivalent property in .Net to the above described properties in VB6.  I hope this helps, let me know if I need to explain more.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21849872
Here is the explanation of ScaleMode if it helps:

ScaleMode is not supported
http://msdn.microsoft.com/en-us/library/fhk6kcce(VS.80).aspx

"In Visual Basic 6.0, the ScaleMode property could be used to change the coordinate system for a form or PictureBox control from the default scale of twips.

Visual Basic 2005 does not support multiple coordinate systems; only pixels are supported. During upgrade, coordinates are automatically converted from twips to pixels; code that sets the ScaleMode property at run time will cause a compilation error and must be modified."



I believe that the DrawMode and DrawStyle can be replicated with the Pen style for the Graphics.DrawString method call (if you are using that).

0
 

Author Comment

by:CKirby18
ID: 21850072
Thanks, that is helpful.  I am in fact using Graphics.DrawString as well.  Are you aware of any sort of listing that matches a Pen style to a DrawMode and DrawStyle?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 150 total points
ID: 21850118
VB6 DrawStyle:

vbSolid =  0            Solid (default)
vbDash = 1            Dash
 vbDot = 2              Dot
 vbDashDot = 3      Dash - dot
 vbDashDotDot = 4  

VB.NET:
               Dim pen As New Pen(Color.Red)

                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
0
 

Author Comment

by:CKirby18
ID: 21850149
Great!  Thanks for your help.  What about DrawMode, does it have any significance in .Net or is DrawStyle all that I need?
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 150 total points
ID: 21850347
Yeah, DrawMode is not that straight-forward:

http://msdn.microsoft.com/en-us/library/aa265091(VS.60).aspx

vbBlackness 1 Black
vbNotMergePen 2 Not Merge pen
vbMaskNotPen 3 Mask Not pen
vbNotCopyPen 4 Not Copy pen
vbMaskPenNot 5 Mask pen Not
vbInvert 6 Invert
vbXorPen 7 Xor pen
vbNotMaskPen 8 Not Mask pen
vbMaskPen 9 Mask pen
vbNotXorPen 10 Not Xor pen
vbNop 11 No operation; output remains unchanged
vbMergeNotPen 12 Merge Not pen
vbCopyPen 13 Copy pen
vbMergePenNot 14 Merge pen Not
vbMergePen 15 Merge pen
vbWhiteness 16 White

DrawStyle Property
vbSolid 0 Solid
vbDash 1 Dash
vbDot 2 Dot
vbDashDot 3 Dash-dot
vbDashDotDot 4 Dash-dot-dot
vbInvisible 5 Invisible
vbInsideSolid 6 Inside solid
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21850351
There is not a direct correlation between VB6 DrawMode and VB.NET, so you will have to look at each case, and see what the "best" approach would be.
0
 

Author Comment

by:CKirby18
ID: 21850358
You have been incredibly helpful, I really appreciate all of your help
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question