Minimize/Restore with hidden caption bar makes window shrink/grow


First of all. I just downloaded the source and do not know if this issue has been up here before. But anyhow. Here I go:
How to reproduce:
Im running XP SP2 - classic mode...
1) I downloaded version 6125 of the source code.
2) Start the Demo sample.
3) Check the "Enable custom borders" checkbox.
4) Minimize the Demo window
5) Restore the Demo window
After restoring the window, it's height has increased (compared to when it was minimized).
Excpected behaviour:
The window should have the same size after it has been restored as it had before being minimized.
The same behaviour exists when the following is done:
1) "Show desktop" (Win+D or Win+M)
2) Restore the Demo window.
I now that the same windows messages are not sent in this case compared to the above, but it should behave the same way.


tweakworks wrote Dec 10, 2008 at 12:39 AM

To fix this use this code
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
base.SetBoundsCore(x, y, width - 8 + ActiveFormStyle.ClientAreaPadding.Horizontal, height - 34 + ActiveFormStyle.ClientAreaPadding.Vertical, specified);

{8; 34} - Width and height of used window borders in classic theme (it's used to show window context menu)

wrote Dec 10, 2008 at 12:40 AM

wrote Apr 11, 2011 at 2:02 PM

wrote Feb 14, 2013 at 8:26 PM