winform下实现win7 Aero磨砂效果实现代码_C#教程-查字典教程网
winform下实现win7 Aero磨砂效果实现代码
winform下实现win7 Aero磨砂效果实现代码
发布时间:2016-12-28 来源:查字典编辑
摘要:效果图:复制代码代码如下:usingSystem;usingSystem.Collections.Generic;usingSystem.C...

效果图:

复制代码 代码如下:

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

}

}

}

}

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新C#教程学习
    热门C#教程学习
    编程开发子分类