通过本文主要向大家介绍了c#无边框窗体阴影,c#无边框窗体移动,c#无边框窗体,c#无边框窗体改变大小,c#窗体边框等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
通过下面代码在构造函数中调用方法 SetShadow();
即可实现无边框窗体的阴影效果了
需要添加命名空间 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);
}
</div>