| Poster | : Hoodlum | | Posts | : 1 | | Country | : UK | | City | : Bolton |
| | | | Posted by Hoodlum on 22/10/2006 at 17:42:12
| | The code presented in this section works fine when increasing the size of the window, but when decreasing the window size beneath the original dimensions, the window contents disappear as before.
Having debugged, the DeviceReset event still gets fired, but the window contents do not get redrawn. Adding a manual call to OnPaint also does not fix this problem.
Has anyone else encountered this, or found a solution?
Cheers | |
|
|
| |
| |
| Poster | : riemer | | Posts | : 1392 | | Country | : Belgium | | City | : Antwerp |
| | | | Posted by riemer on 23/10/2006 at 02:42:58
| | Yes indeed, I have noticed the same, and to be honest, I have learned to live with it ;)
I have tried several methods I found on the net, but they all give the same result.
| |
|
|
| |
| |
| Poster | : Anonymous | | Posts | : | | Country | : | | City | : |
| | | | Posted by Anonymous on 14/11/2006 at 08:59:59
| | There's a problem with "this.Width / this.Height" - it's an integer division, and when Width<Height it gives you zero.
Writing "(float) this.Width / this.Height" instead should fix it.
Zbignief | |
|
|
| |
| |
| Poster | : riemer | | Posts | : 1392 | | Country | : Belgium | | City | : Antwerp |
| | | | Posted by riemer on 16/11/2006 at 02:53:55
| | | Thanks a lot! I've replaced those lines in the ShortTut chapter. | |
|
|
| |
| |
| Poster | : Anonymous | | Posts | : | | Country | : | | City | : |
| | | | Posted by Anonymous on 03/03/2008 at 15:13:32
| | | It seems because the Paint event is not triggered when decreasing the size. You might want to respond Form.SizeChanged event. | |
|
|
| |
| |
| Poster | : Anonymous | | Posts | : | | Country | : | | City | : |
| | | | Posted by Anonymous on 08/04/2008 at 12:22:40
| | In order to properly redraw, make sure that in the form's constructor you add this:
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
Next, you also need to add this to the form's OnPaint event:
this.Invalidate();
He covered this in Series 1 Tutorial 3 (Drawing a Triangle). Also, make sure you clear the device, as otherwise the previous render will remain in the buffer. | |
|
|