I have a full-screen window, using this code:
WindowStyle = System.Windows.WindowStyle.None;
WindowState = System.Windows.WindowState.Maximized;
Topmost = true;
It works ok under Win7, but under WinXP some window elements don't get redrawn when the window goes fullscreen. Is there any way to force window to make full redraw and layout update?
UPD all is redrawn ok, if I switch to another app with Atl-Tab and then back to mine
You could force the window to repaint by using the Windows API.
Example class implementation:
public static class WindowsApi
{
private const int WmPaint = 0x000F;
[DllImport("User32.dll")]
public static extern Int64 SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
public static void ForcePaint(this Form form)
{
SendMessage(form.Handle, WmPaint, IntPtr.Zero, IntPtr.Zero);
}
}
Usage:
Form testForm = new Form();
testForm.ForcePaint();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With