zoukankan      html  css  js  c++  java
  • 创建非矩形窗体

    实现效果:

      

     知识运用:

      通过重写窗体的OnPaint方法 在其中对窗体进行重绘 并使用透明色将窗体设置为透明来实现

      OnPaint方法: 用来从新绘制窗体图像 

      protected override void OnPaint(PaintEventArgs e) //painteventargs为Paint事件提供数据

      Bitmap类的MakeTransparent方法: 使用指定颜色对位图进行透明  

         public void MakeTransparent(Color transparentColor)  //transparentColor:Color结构 表是使之透明的颜色

      this.BackColor = System.Drawing.SystemColors.Control;

      this.TransparencyKey = System.Drawing.SystemColors.Control;

    实现代码:  

            private void Form1_Load(object sender, EventArgs e)
            {
                bit = new Bitmap(Properties.Resources.bit);//从指定的图像初始化Bitmap对象
                bit.MakeTransparent(Color.Black);       //使用指定的颜色对Bitmap位图透明
            }
            protected override void OnPaint(PaintEventArgs e)
            {
                e.Graphics.DrawImage(bit, new Point(0, 0));   //在窗体上绘制图片
            }
    
  • 相关阅读:
    polya定理
    树状数组
    离散数学通路数的矩阵计算法
    高次同余方程求解
    Uva1378
    poj2888
    poj2409&&poj1286
    poj2182
    poj2154
    判断一个字符是否为汉字
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10111666.html
Copyright © 2011-2022 走看看