Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert VB6 "Drawing Styles" to .Net

Posted on 2008-06-23
11
Medium Priority
?
1,770 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
Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

 

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 600 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 600 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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

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

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.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

688 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