Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,883 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
When I process the WM_NCCALCSIZE message, after minimizing and restoring the window, the window gains some size each time. I know it is caused by the function RestoreBoundsIfNecessary called in the WM_WINDOWPOSCHANGED message handler. And a solution has been provided for the issue in that stackoverflow question. But could there be a better solution? I'm waiting for your ideas. Also, this is a gif picture describing the issue.
Best wishes
A way (tested on Windows 10, 1909, .NET 4.7.2) =>
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
{
base.SetBoundsCore(RestoreBounds.Left, RestoreBounds.Top, RestoreBounds.Width, RestoreBounds.Height, BoundsSpecified.All);
}