How do i keep picbox painted?

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
HelpNeeded

How do i keep picbox painted?

Post by HelpNeeded »

Hi,

I have an application that draws animation to a picbox in visual basic 2005. I was previously using directx and there was a command to "restoreallsurfaces", which i think kept the pic box painted when objects were drug over it (like menu items) or the window was moved around.

In irrlicht everything works fine except that when the form loads the pic box is blank until i begin the animation (even though i draw to it on form load) and if i open a menu over the pic box it leaves an unpainted white square where the menu was until i restart the animation.

does anyone know what i need to do to keep that picbox painted while the animation sequence isn't running?

thanks.
Braneloc
Posts: 68
Joined: Fri Jan 20, 2006 5:12 am
Location: England
Contact:

Post by Braneloc »

http://www.irrforge.org/index.php/CS_Tutorial_14
http://www.irrforge.org/index.php/.cs_to_.vb
http://www.irrforge.org/index.php/.net

You need to tag the paint event on the picturebox and refresh the display when it is being overwritten by windows.. the effect you are getting is completely normal.

Set animationOrWhateverRunning=true; while in your own render loop.
You also might want to investigate picturebox.Invalidate in your main loop everytime something changes as well if you really don't want a constant refresh update.

in C#, sorry I don't speak VB, shouldn't be too different though, check the links above for converters and more help.
You'll need to clean this up.. it's pretty much from memory and very rough.

Code: Select all

bool animationOrWhateverRunning;
picturebox.Paint+=new whateverEventHandlerICantRememebrOffHand(extraRefresh);

...


void extraRefresh(whateverParamsItLikes)
{
         if (!animationOrWhateverRunning)
         {
                device.VideoDriver.BeginScene(true, true, new Irrlicht.Video.Color(255, 0, 0, 50));
                device.SceneManager.DrawAll();
                device.GUIEnvironment.DrawAll();
                device.VideoDriver.EndScene();
        }
}
PS, crossposting, especially to beginners really stresses those guys out. Can't always get an instant answer, not everyone checks the forums several times a day.
Sometimes you've just gotta say, the laws of time and space, who gives a smeg ?!

Irrlicht.Net Information - http://www.irrforge.org/index.php/.net
Irrlicht# (aka the C# port) - http://irrlichtsharp.sourceforge.net
Guest

Post by Guest »

thank you very much.

i'll go thank you in the other forum as well, hehe
Locked