Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • 2 weeks later...
Posted

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

Phil Price�

Visual Studio .NET 2003 Enterprise Edition

Microsoft Student Partner 2004

Microsoft Redmond, EMEA Intern 2004

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...