Link to home
Start Free TrialLog in
Avatar of sn1fflez
sn1fflez

asked on

What are Alternatives to the AutoRedraw Property (vb6) not available in VB.NET

Hello everyone,

Okay, so I've put together an example program demonstrating the effect of not having the autoredraw property (in vb.net) had on my program.
The example program consists of two forms a picturebox and a couple of buttons. I've used the tao framework wrapper for the graphics and all of my code is within the paint event handler. This, apperantly, is not enough to make the graphics persistent. I have included the tao framework installation needed to run the example program in the zip file attached to this question.
Please run the example program, outline what you think is going on in the problem, and give your suggestion to making the graphics more consistently persistent.
I would like to award as many points as possible to every person who has contributed a helpful suggestion (if anyone can tell me how to do this without creating another post) otherwise I will give the best solution/suggestion all of the points.
Things to keep in mind when making suggestions: I must use the picturebox control and opengl (tao framework). I also need to be able to use the code to produce animations so saving the contents of the picturebox and setting it to the .image of the picturebox may not be too practical but I would like to hear opinions on this.
Any and all replies will be greatly appreciated.
Thank you for your time,
Sn1fflez     GraphicsFlicker3.zip
Avatar of ladarling
ladarling
Flag of United States of America image

What exactly is the example project supposed to do? Ive downloaded and run the example. but the only result I get is that clicking the "Apply" button on the popup invalidates a picture box on the background form and disables it...?
Avatar of sn1fflez
sn1fflez

ASKER

Oh I'm sorry I forgot to explain what you should see when you run the project. The sample project should show a disk on a black background. When you first load the project nothing will be shown but if you invalidate the picturebox by moving it off the screen a little the graphics should be drawn. With the graphics drawn, if you then click the button on the upper right of the background form another form should pop up but in doing so the graphics in the picturebox are lost. If you click okay then the graphics should come back but the portion of the screen that was covered by the popup form should not have been repainted correctly.
I beleive losing the graphics on form loads etc. to be a consequence of not having the autoredraw property in vb.net. I would like to know if maybe there is something else that might be going on and an efficient solution to the problem. Hope this helps clarify things a bit better.
ASKER CERTIFIED SOLUTION
Avatar of ladarling
ladarling
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ladarling:
Thanks for the response, I will look into the changes your suggesting. But, if I do end up going with a picture box:
What do you think about overriding all of the painting handlers for a picturebox to do nothing and then create my own event to handle 100% of all the drawing  done on the picturebox with opengl? would it be possible to override all of the paint handlers of the picturebox to do nothing? which ones are they? onpaint, onpaintbackground, and paint?
ps. I want to accept your above post as a solution but I also would like to see more responses from other people. I think the system is set up to distribute the 500 points between all the accepted solutions which I don't think anyone would want so maybe I should just give the 500 with an A grade to the best solution?
It is possible to override 100% if you create a custom PictureBox that inherits from the original. I have not tried it, but if the base class has the OnPaint function marked as NonOverrideable (unlikely) then you can use the Shadows modifier to nullify its effect.