Monday, July 27, 2009

Is there a proper way to repaint when a window is minimized?

language: c#





is there just a simple way to have the screen repaint?


i have a class that is a couple hundred lines long which is painting to the form that called it. now, i could have it use similiar code to recalculate how everything should be each time the window changes. ...but there are a LOT of calculations that have to be done.





i dont know if what i am doing now is the right way to do things. i have about 20 global variables that i initialize in the classes constructor. then I use those variables in a method called paint(). ...but there is still a lot of calculations that need to be done and i just get the feeling that this cant be the right way to do this.





do you have any ideas or could you guide me towards the conventional way to do this? ...i have looked at at least 900,000 tutorials today and they arent really helping.

Is there a proper way to repaint when a window is minimized?
Out of my mind, there is a way you can do it if you are using C# or any other .NET language. If your painting and calculation code is in paint method, then you just need to force the form to redraw itself each time its visibility changes. On the Activate event of the form, just call this method.


this.Invalidate();


This method will cause the form to redraw itself.
Reply:Ahhh, things are so simple in VB..... From.AutoRedraw = True





Hope the link below helps:





http://msdn2.microsoft.com/en-us/library...
Reply:its best to do the calculations and get an exact. if you half *** and mess up then all the work will be wasted
Reply:...... Sorry but, openGl, SDL, Directx? Windows, linux, Mac?


if (eventfromOS != 0) ?


All will give you something to work with if the window changes


No comments:

Post a Comment