-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWindowShadow.cs
More file actions
38 lines (33 loc) · 888 Bytes
/
WindowShadow.cs
File metadata and controls
38 lines (33 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Runtime.InteropServices;
using Microsoft.UI.Xaml;
using WinRT.Interop;
namespace NoteUI;
internal static class WindowShadow
{
public static void Apply(IntPtr hwnd)
{
var margins = new MARGINS
{
leftWidth = 0,
rightWidth = 0,
topHeight = 0,
bottomHeight = 1
};
DwmExtendFrameIntoClientArea(hwnd, ref margins);
}
public static void Apply(Window window)
{
var hwnd = WindowNative.GetWindowHandle(window);
Apply(hwnd);
}
[DllImport("dwmapi.dll")]
private static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS pMarInset);
[StructLayout(LayoutKind.Sequential)]
private struct MARGINS
{
public int leftWidth;
public int rightWidth;
public int topHeight;
public int bottomHeight;
}
}