C# 无边框窗体边框阴影效果的简单实现_C#教程-查字典教程网
C# 无边框窗体边框阴影效果的简单实现
C# 无边框窗体边框阴影效果的简单实现
发布时间:2016-12-28 来源:查字典编辑
摘要:通过下面代码在构造函数中调用方法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#教程学习
    编程开发子分类