Skip to content
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

Doubled buttons on transparent background window #169

Closed
GliczDev opened this issue Oct 1, 2022 · 2 comments
Closed

Doubled buttons on transparent background window #169

GliczDev opened this issue Oct 1, 2022 · 2 comments

Comments

@GliczDev
Copy link

GliczDev commented Oct 1, 2022

Describe the bug

Window with transparent background has doubled buttons

Steps to reproduce the bug

Create window with transparent background and see effect

Expected behavior

Not doubled buttons

Screenshots

obraz

NuGet package version

HandyControls (Custom version) 3.4.0

IDE

Visual Studio 2022-preview

Framework type

.Net 6.0

Windows version

Insider Build (xxxxx)

Additional context

No response

@GliczDev GliczDev changed the title Bug title Doubled buttons on transparent background window Oct 1, 2022
@MesuDevastator
Copy link

+same doubled buttons

@GliczDev
Copy link
Author

Okay, so i've made a research, and this should fix this problem

private const int GWL_STYLE = -16;
private const int WS_SYSMENU = 0x80000;
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

public static void FixBackground(Window window)
{
    var hwnd = new WindowInteropHelper(window).Handle;
    SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants