Ive upgraded an app from VB 6.0 to .NET 2005 Express, my problem is that in the pass i used the line, circle and print methos over a picture box to show a big graphic. Now ive changed old methods for drawrectangle, drawline, drawstring etc.. over the paint event. The final results are the same but the speed of the .NET versiuon is awesome SLOW like a turttle, when i click in the scroolbars to see other part of the picturebox the paint event activate and its too slow. Can i draw in the picture without writing code in his paint event
Thank you in advance

Graphics class too slow and Drawing too
Krishna K Rama
You may consider to add this code in form constructor:
Public Sub New() MyBase.New() InitializeComponent()
SetStyle(ControlStyles.OptimizedDoubleBuffer
Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint, True)SetStyle(ControlStyles.ResizeRedraw,
True) End SubI used these lines on a application where I used custom paint events and the speed was increased dramatically with no flickering on resize or move.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
WedgeSoft
Graphics in dot net are really different from vb6. Sometimes I draw on a bitmap I so I dont have to handle the redraw. For this example I placed a picturebox inside a panel. I set the panels autoscroll to true and the picturebox sizemode to autosize. This will allow you to scroll the image with out having to redraw it.
Bob Powell's web site has a lot of graphics information.
http://www.bobpowell.net/
Free online book about upgrading to vb.net
http://msdn.microsoft.com/vbrun/staythepath/additionalresources/upgradingvb6/
Dim bm As Bitmap
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
bm = New Bitmap("C:\bliss.jpg")
Dim g As Graphics = Graphics.FromImage(bm)
g.FillEllipse(Brushes.Red, 100, 100, 100, 100)
PictureBox1.Image = bm
End Sub
Dont forget you can always post code that you feel is to slow and maybe someone can help you improve the speed
JB Trexler
Me_Titus
Yes. use the pictureboxes creategraphics method to be able to draw outside of the paint event.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim g As Graphics = PictureBox1.CreateGraphics
g.FillEllipse(Brushes.Blue, 0, 0, 20, 20)
g.Dispose()
End Sub