Solved

Convert VB6 "Drawing Styles" to .Net

Posted on 2008-06-23
11
1,559 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
  • 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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This is about my first experience with programming Arduino.
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 …
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now