Files
parsec-vdd/app/Shadow.cs
T
2024-03-29 23:27:09 +07:00

38 lines
1.0 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace ParsecVDisplay
{
internal static class Shadow
{
[DllImport("dwmapi.dll")]
static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
[StructLayout(LayoutKind.Sequential)]
struct MARGINS
{
public int leftWidth;
public int rightWidth;
public int topHeight;
public int bottomHeight;
}
[DllImport("dwmapi.dll")]
static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
public static void ApplyShadow(IntPtr hwnd)
{
var v = 2;
DwmSetWindowAttribute(hwnd, 2, ref v, 4);
var margins = new MARGINS
{
bottomHeight = 0,
leftWidth = 0,
rightWidth = 0,
topHeight = 1
};
DwmExtendFrameIntoClientArea(hwnd, ref margins);
}
}
}