[Common]fix fancy zones exclusion (#16041)

replace WS_POPUP with WS_EX_TOOLWINDOW
This commit is contained in:
Davide Giacometti
2022-02-07 20:16:36 +01:00
committed by GitHub
parent 49a2218358
commit e284b07da7
10 changed files with 22 additions and 22 deletions

View File

@@ -31,7 +31,7 @@ namespace ColorPicker
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
NativeMethods.SetPopupStyle(this);
NativeMethods.SetToolWindowStyle(this);
}
}
}

View File

@@ -59,7 +59,7 @@
<PackageReference Include="System.ComponentModel.Composition" Version="5.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.IO.Abstractions" Version="12.2.5" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -15,8 +15,8 @@ namespace ColorPicker
// will have to rename
public static class NativeMethods
{
private const int GWL_STYLE = -16;
private const int WS_POPUP = 1 << 31; // 0x80000000
private const int GWL_EX_STYLE = -20;
private const int WS_EX_TOOLWINDOW = 0x00000080;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
@@ -180,10 +180,10 @@ namespace ColorPicker
[DllImport("user32.dll")]
internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
internal static void SetPopupStyle(Window win)
internal static void SetToolWindowStyle(Window win)
{
var hwnd = new WindowInteropHelper(win).Handle;
_ = SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP);
_ = SetWindowLong(hwnd, GWL_EX_STYLE, GetWindowLong(hwnd, GWL_EX_STYLE) | WS_EX_TOOLWINDOW);
}
}
}