JCreationsInc Posted May 3, 2003 Posted May 3, 2003 Hello everyone! I am a vb6 verteran and I am just begining to learn vb.net and it is going pretty well. Luckily I have found this site with such skilled programmers to ask questions to! :D Well then on to my questions. What I am doing is creating a Program for my Programs that would allow you to easily create "Skins" using a type of designer like vb.net that allows you to drag the images arround the window and place them were you like them to be. But in testing when I drag the image arround the window using drawimage, I get HORRIBLE flicker and I Have tried everything to circumvent it, but to no avail. In vb6 double buffering was pretty easy, all you had to do was create a DC (Device Context) in memory using "CreateCompatibleDC" then Create a Surface for the image in the DC using "CreateCompatibleBitmap". Then you would draw on you surface and the paint it to your form or picture box. Now comes GDI+ and Managed code, AAAAAAAAAAAHHHHHHHHHH!!!!!!!! :eek: GDI+ has some nice features and is VERY much more robust than gdi32, but creating a graphics object in memory is so confusing and frustraiting! So then I google it and I come to this site with these forums and I learn that you can envoke a double buffering method built right into the windows controlstyles namespace. So then I attempt to research it and I get nothing but a headache and a wicked urge to just smash this computer with a 50lb sledge hammer! :mad: Anyways what I am asking you fine people stuck in my lil box on top of my desk is, how do you Double buffer using an object created in memory? OR how do you use the double buffering built into the .Net Framework? All imput will be greatly Appreciated! Quote When in doubt.... use the sledge Hammer!!
*Gurus* divil Posted May 3, 2003 *Gurus* Posted May 3, 2003 To enable double buffering for a control, use the SetStyle method in the constructor to turn on AllPaintingInWmPaint and DoubleBuffer. That will enable it. The next thing you must remember to do is do all your drawing in either the Paint event or the OnPaint method if you've overridden it (it doesn't matter which). Next, you must always use the instance of the Graphics class passed to that procedure in the e argument. You don't have to worry about doing anything with offscreen surfaces, Windows Forms takes care of that for you using the fastest possible way (DIB sections). The only caveat is that you must do all your drawing in that procedure. Use the control's Invalidate method or Refresh method to cause it to be invoked if you need to. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
JCreationsInc Posted May 3, 2003 Author Posted May 3, 2003 Thanks you were a big help you poited me in the right direction! One other thing how did you learn how to use vs.net? did you goto school? or did you read some books? and if you read books on the subject, do you recomend any for a guy like me? Quote When in doubt.... use the sledge Hammer!!
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.