leazfe Posted April 30, 2004 Posted April 30, 2004 I have the follow problem: The first time i draw the image I get a blank screen( The image stay only a half second) but the next time the image is good drawn. I have looked for a refresh method but i didn´t find it. Any help? By the way, i have to decide where i want the image to be drawn with the X and Y parameter and it is really stupid. Does anyone know another better way? The code is: Dim gr As Graphics = Me.CreateGraphics Dim bmpAs New Bitmap("image.png") gr.DrawImage(bmpUnten, 50, 150) gr.Dispose() bmp.Dispose() Thanks, Alvaro Quote
philprice Posted May 14, 2004 Posted May 14, 2004 This happens as when the form is asked to redraw it's self - it calls its OnPaint method (which i am assuming you have not handeled) - therefore it is cleared. What you need to do is capture the Paint event of the control you are drawing the imagine onto - and draw your image onto e.Graphics (where e is the event object captured in the event - you'll see). Everything Invalidate is called (you can do this manually via Control.Invalidate()) the Paint event is called where your code to plot the image should reside. Hope this helps Quote Phil Price� Visual Studio .NET 2003 Enterprise Edition Microsoft Student Partner 2004 Microsoft Redmond, EMEA Intern 2004
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.