Jump to content
Xtreme .Net Talk

Recommended Posts

Guest mutant
Posted
Is it possible to have like 2 layers of graphics in GDI+? I have some image that stays in the background and i dont wish to have to draw it every time paint is fired because i can see the picture get flicker.
Guest mutant
Posted
Thats weird, i can get the double buffering to work with shapes, but it doesnt with images :( . Could show me an example for images or point me to some source where I could maybe find a tutorial or some explanation? Couldnt find any.
Guest mutant
Posted

I found a sample on internet.

       Dim bmp As New Bitmap(30, 30)
       Dim g As Graphics = Graphics.FromImage(bmp)
       g.DrawImage(New Bitmap("image.jpg"), 0, 0)
       Dim x As Integer
       For x = 0 To 5
       e.Graphics.DrawImage(bmp, x * 30, 0)
       Next

Is this correct?

  • *Gurus*
Posted

That works fine for me - I take it you've enabled the DoubleBuffer and AllPaintingInWmPaint styles for the form/control? Remember you don't have to do anything yourself to get double buffering to work, once you've set those two styles .NET does the rest.

 

As a side note, that code is nasty - it doesn't clean up any of the resources it uses.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Guest mutant
Posted
Thats funny, no of the articales said that I only need to setstyle to double buffer and .NET will do the rest, they told me to draw images like i showed before. Oh well, at least now its working all right :)

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