winform下實(shí)現(xiàn)win7 Aero磨砂效果實(shí)現(xiàn)代碼
更新時(shí)間:2012年03月12日 16:24:44 作者:
winform下實(shí)現(xiàn)win7 Aero磨砂效果實(shí)現(xiàn)代碼,需要的朋友可以參考下
效果圖:

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

復(fù)制代碼 代碼如下:
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);
}
}
}
}
您可能感興趣的文章:
- WinForm實(shí)現(xiàn)窗體最大化并遮蓋任務(wù)欄的方法
- C#實(shí)現(xiàn)WinForm禁止最大化、最小化、雙擊標(biāo)題欄、雙擊圖標(biāo)等操作的方法
- Winform實(shí)現(xiàn)鼠標(biāo)可穿透的窗體鏤空效果
- Winform窗體效果實(shí)例分析
- WinForm實(shí)現(xiàn)自定義右下角提示效果的方法
- WinForm實(shí)現(xiàn)仿視頻播放器左下角滾動(dòng)新聞效果的方法
- C#實(shí)現(xiàn)winform漸變效果的方法
- WinForm實(shí)現(xiàn)同時(shí)讓兩個(gè)窗體有激活效果的特效實(shí)例
- C# WinForm實(shí)現(xiàn)Win7 Aero透明效果代碼
- 用 C# Winform做出全透明的磨砂玻璃窗體效果代碼
- WinForm實(shí)現(xiàn)狀態(tài)欄跑馬燈效果的方法示例
相關(guān)文章
C#中的靜態(tài)成員、靜態(tài)方法、靜態(tài)類(lèi)介紹
本文主要介紹了C#中的靜態(tài)成員、靜態(tài)方法、靜態(tài)類(lèi)的基礎(chǔ)的使用,并做了相關(guān)的代碼演示,供初學(xué)者參考。2016-03-03C#傳值方式實(shí)現(xiàn)不同程序窗體間通信實(shí)例
Form2構(gòu)造函數(shù)中接收一個(gè)string類(lèi)型參數(shù),即Form1中選中行的文本,將Form2的TextBox控件的Text設(shè)置為該string,即完成了Form1向Form2的傳值2013-12-12C#使用SqlDataAdapter對(duì)象獲取數(shù)據(jù)的方法
這篇文章主要介紹了C#使用SqlDataAdapter對(duì)象獲取數(shù)據(jù)的方法,結(jié)合實(shí)例形式較為詳細(xì)的分析了SqlDataAdapter對(duì)象獲取數(shù)據(jù)具體步驟與相關(guān)使用技巧,需要的朋友可以參考下2016-02-02c#學(xué)習(xí)之30分鐘學(xué)會(huì)XAML
一個(gè)界面程序的核心,無(wú)疑就是界面和后臺(tái)代碼,而xaml就是微軟為構(gòu)建應(yīng)用程序界面而創(chuàng)建的一種描述性語(yǔ)言,也就是說(shuō),這東西是搞界面的2016-11-11C#中跨線(xiàn)程訪(fǎng)問(wèn)控件問(wèn)題解決方案分享
這篇文章主要介紹了C#中跨線(xiàn)程訪(fǎng)問(wèn)控件問(wèn)題解決方案,有需要的朋友可以參考一下2013-11-11