调用user32.dll为winform窗体设置阴影
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
using System.Runtime.InteropServices; public partial class About : Form { public About() { InitializeComponent(); SetClassLong(Handle, GCL_STYLE, GetClassLong(Handle, GCL_STYLE) | CS_DropSHADOW); } #region 制作窗口阴影 private const int CS_DropSHADOW = 0X20000; private int GCL_STYLE = (-26); [DllImport("user32", CharSet = CharSet.Auto)] public static extern int SetClassLong(IntPtr hwnd, int nIndex, int dwNewLong); [DllImport("user32", CharSet = CharSet.Auto)] public static extern int GetClassLong(IntPtr hwnd, int nIndex); #endregion } |