手机
当前位置:查字典教程网 >编程开发 >C#教程 >C# 无边框窗体边框阴影效果的简单实现
C# 无边框窗体边框阴影效果的简单实现
摘要:通过下面代码在构造函数中调用方法SetShadow();即可实现无边框窗体的阴影效果了需要添加命名空间usingSystem.Runtime...

通过下面代码在构造函数中调用方法 SetShadow();

即可实现无边框窗体的阴影效果了

需要添加命名空间 using System.Runtime.InteropServices;

复制代码 代码如下:

private const int CS_DropSHADOW = 0x20000;

private const int GCL_STYLE = (-26);

[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);

}

【C# 无边框窗体边框阴影效果的简单实现】相关文章:

C#修改MAC地址类的实例

分享C#操作内存读写方法的主要实现代码

C# 中文简体转繁体实现代码

c# 控件截图的简单实例

C#最简单的关闭子窗体更新父窗体的实现方法

C# 拓展方法的简单实例

C# 获取枚举值的简单实例

c# 网址压缩简单实现短网址

C#中把日志导出到txt文本的简单实例

C# L型棋牌覆盖实现代码与效果

精品推荐
分类导航