基本信息
源码名称:C# 磨砂玻璃窗口 例子(vista)
源码大小:0.06M
文件格式:.zip
开发语言:C#
更新时间:2016-09-14
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MothGlass
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();

      // If DWM is not enabled then get out
      if (!this.IsGlassEnabled())
      {
        return;
      }

      // Set the Margins to their default values
      VistaApi.Margins marg;
      marg.Top = panel1.Height; // extend from the top
      marg.Left = 0;  // not used in this sample but could be
      marg.Right = 0; // not used in this sample but could be
      marg.Bottom = 0;// not used in this sample but could be

      // call the function that extends the sides, 
      // passing a reference to our inset Margins
      VistaApi.DwmExtendFrameIntoClientArea(this.Handle, ref marg);      
    }

    private bool IsGlassEnabled()
    {
      if (Environment.OSVersion.Version.Major < 6)
      {
        MessageBox.Show(
          "How about trying this on Vista?");
        return false;
      }

      //Check if DWM is enabled
      bool isGlassSupported = false;
      VistaApi.DwmIsCompositionEnabled(ref isGlassSupported);
      return isGlassSupported;
    }

    private void Form1_Load(object sender, EventArgs e)
    {
      Color c = Color.FromArgb(255, 221, 220, 220);
      this.TransparencyKey = c;
      panel1.BackColor = c;
    }
  }
}