zoukankan      html  css  js  c++  java
  • [转]WinForm实现win7 Aero磨砂效果介绍

    WinForm实现win7 Aero磨砂效果如下:

    WinForm实现win7 Aero磨砂效果代码如下:

    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);
    }
    }
    }
    }
  • 相关阅读:
    试述软件的概念和特点?软件复用的含义?构件包括哪些?
    Spring Security基本用法
    java中跳出循环的方式
    cookie和session区别
    spring中类型注解下的bean的加载顺序
    常见的异常
    aop使用场景
    缓存类似于redis
    旧版redis使用
    获取rdis的几种方式
  • 原文地址:https://www.cnblogs.com/qq1223558/p/3227120.html
Copyright © 2011-2022 走看看