通過(guò)下面代碼在構(gòu)造函數(shù)中調(diào)用方法 SetShadow();
即可實(shí)現(xiàn)無(wú)邊框窗體的陰影效果了
需要添加命名空間 using System.Runtime.InteropServices;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SetClassLong(IntPtr hwnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int GetClassLong(IntPtr hwnd, int nIndex);
private void SetShadow()
{
SetClassLong(this.Handle, GCL_STYLE, GetClassLong(this.Handle, GCL_STYLE) | CS_DropSHADOW);
}
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注