-
-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App sometimes gets cut when maximized #182
Comments
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: