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

源码网商城

winform下实现win7 Aero磨砂效果实现代码

  • 时间:2021-04-06 09:17 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:winform下实现win7 Aero磨砂效果实现代码
效果图: [img]http://files.jb51.net/upload/201203/20120312162254492.png[/img]
[u]复制代码[/u] 代码如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.ServiceModel; using System.Runtime.InteropServices; namespace MyWeather { public partial class Form1 : Form { [StructLayout(LayoutKind.Sequential)] public struct MARGINS { public int Left; public int Right; public int Top; public int Bottom; } [DllImport("dwmapi.dll", PreserveSig = false)] static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins); [DllImport("dwmapi.dll", PreserveSig = false)] static extern bool DwmIsCompositionEnabled(); public Form1() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { if (DwmIsCompositionEnabled()) { MARGINS margins = new MARGINS(); margins.Right = margins.Left = margins.Top = margins.Bottom = this.Width + this.Height; DwmExtendFrameIntoClientArea(this.Handle, ref margins); } base.OnLoad(e); } protected override void OnPaintBackground(PaintEventArgs e) { base.OnPaintBackground(e); if (DwmIsCompositionEnabled()) { e.Graphics.Clear(Color.Black); } } } }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部