Closed NotroDev closed 1 year ago
I think I fixed it with this code:
[DllImport("user32.dll")]
static extern IntPtr GetWindow(IntPtr hWnd, uint wCmd);
const uint GW_HWNDNEXT = 2;
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool IsWindowVisible(IntPtr hWnd);
private void OnSizeChanged(object sender, SizeChangedEventArgs e)
{
FixCut();
}
private void FixCut()
{
if (WindowState == WindowState.Maximized)
{
IntPtr hWnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;
IntPtr hNext = hWnd;
do
hNext = GetWindow(hNext, GW_HWNDNEXT);
while (!IsWindowVisible(hNext));
SetForegroundWindow(hNext);
Activate();
}
}
private void Window_StateChanged(object sender, EventArgs e)
{
FixCut();
}
Tnx but i am not working with wpf anymore
Describe the bug
App sometimes gets cut in left top corner when maximized.
Steps to reproduce the bug
Expected behavior
No response
Screenshots
NuGet package version
HandyControls (Custom version) 3.4.0
IDE
Visual Studio 2022
Framework type
.Net 6.0
Windows version
Windows 11 (22000)
Additional context
HandyControls' version is 3.4.4.