源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

C# 无边框窗体边框阴影效果的简单实现

  • 时间:2022-08-08 12:12 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:C# 无边框窗体边框阴影效果的简单实现
通过下面代码在构造函数中调用方法 SetShadow(); 即可实现无边框窗体的阴影效果了 需要添加命名空间 using System.Runtime.InteropServices;
[u]复制代码[/u] 代码如下:
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);         }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部