mirror of
https://github.com/nomi-san/parsec-vdd.git
synced 2026-08-07 13:50:45 +00:00
Move drop shadow helper
This commit is contained in:
@@ -75,5 +75,35 @@ namespace ParsecVDisplay
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
static extern int SetThreadExecutionState(uint esFlags);
|
||||
|
||||
public static void EnableDropShadow(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);
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace ParsecVDisplay
|
||||
base.OnSourceInitialized(e);
|
||||
|
||||
var hwnd = new WindowInteropHelper(this).EnsureHandle();
|
||||
Shadow.ApplyShadow(hwnd);
|
||||
Helper.EnableDropShadow(hwnd);
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
|
||||
@@ -86,7 +86,6 @@
|
||||
<Compile Include="Device.cs" />
|
||||
<Compile Include="Display.cs" />
|
||||
<Compile Include="Helper.cs" />
|
||||
<Compile Include="Shadow.cs" />
|
||||
<Compile Include="Tray.cs" />
|
||||
<Compile Include="ParsecVDD.cs" />
|
||||
<Compile Include="Updater.cs" />
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user