• 大小: 22KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: C#
  • 标签: c#  

资源简介

c#自己做的自定义透明按钮控件,简单实用。

资源截图

代码片段和文件信息

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


namespace thirdbuttons
{
    public partial class button2 : Button
    {
        ///  
        /// 必需的设计器变量。 
        /// 
 
        //private System.ComponentModel.Container components = null;
        private bool XiaCen = false;
        private bool mouseMove = false;
        private Color backColor; 




        public button2()
        {
            InitializeComponent();
            // TODO: 在 InitComponent 调用后添加任何初始化 
            backColor = this.backColor;
            //this.Text=this.ShowFocusCues.ToString(); 

        }

        protected GraphicsPath GetGraphicsPath(Rectangle rect)
        {
            GraphicsPath ClientPath = new System.Drawing.Drawing2D.GraphicsPath();
            if (rect.Width <= 0)
            {
                rect.Width = 1;
            }
            if (rect.Height <= 0)
            {
                rect.Height = 1;
            }

            ClientPath.AddArc(rect.Left rect.Top rect.Height rect.Height 90f 180f);
            ClientPath.AddArc(rect.Right - rect.Height rect.Top rect.Height rect.Height 270f 180f);
            ClientPath.CloseFigure();
            return ClientPath;
        }

        protected GraphicsPath GetGraphicsPath1(Rectangle rect)
        {
            GraphicsPath ClientPath = new System.Drawing.Drawing2D.GraphicsPath();
            if (rect.Width <= 0)
            {
                rect.Width = 1;
            }
            if (rect.Height <= 0)
            {
                rect.Height = 1;
            }

            ClientPath.AddArc(rect.Left rect.Top rect.Height rect.Height 190f 80f);
            ClientPath.AddArc(rect.Right - rect.Height rect.Top rect.Height rect.Height 270f 80f);
            ClientPath.CloseFigure();
            return ClientPath;
        }

        private void DrawYinYing(Graphics gr bool xiacen)
        {
            Rectangle rect = this.ClientRectangle;
            rect.Inflate(-(rect.Width / 10) -(rect.Height) / 4);
            float bf1 = rect.Width / 100f;
            float bf2 = rect.Height / 100f;

            rect.Y = rect.Y + this.ClientRectangle.Height / 4;
            if (xiacen)
            {
                rect.Y = rect.Y + 4;
            }
            GraphicsPath path;

            for (int a = 1; a < 33; a++)
            {
                float bf3 = bf1 * a;
                float bf4 = bf2 * a;
                Rectangle rect1 = rect;
                rect1.Inflate(-(int)bf3 -(int)bf4);
                path = GetGraphicsPath(rect1);

                int r = backColor.R;
                int g = backColor.G;
                int b = backColor.B;
                r =

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        925  2009-08-26 14:28  thirdbuttons\thirdbuttons.sln

    ..A..H.     12800  2009-08-26 17:19  thirdbuttons\thirdbuttons.suo

     文件       2282  2009-08-26 17:17  thirdbuttons\thirdbuttons\thirdbuttons.csproj

     文件       1317  2009-08-26 14:28  thirdbuttons\thirdbuttons\Properties\AssemblyInfo.cs

     文件      19968  2009-08-26 17:19  thirdbuttons\thirdbuttons\obj\Debug\thirdbuttons.pdb

     文件      20480  2009-08-26 17:19  thirdbuttons\thirdbuttons\obj\Debug\thirdbuttons.dll

     文件        154  2009-08-26 17:19  thirdbuttons\thirdbuttons\obj\thirdbuttons.csproj.FileList.txt

     文件      20480  2009-08-26 17:19  thirdbuttons\thirdbuttons\bin\Debug\thirdbuttons.dll

     文件      19968  2009-08-26 17:19  thirdbuttons\thirdbuttons\bin\Debug\thirdbuttons.pdb

     文件       1887  2009-08-26 17:16  thirdbuttons\thirdbuttons\button2.Designer.cs

     文件       7967  2009-08-26 17:16  thirdbuttons\thirdbuttons\button2.cs

     目录          0  2009-08-26 14:36  thirdbuttons\thirdbuttons\obj\Debug\TempPE

     目录          0  2009-08-26 17:16  thirdbuttons\thirdbuttons\obj\Debug\Refactor

     目录          0  2009-08-26 14:36  thirdbuttons\thirdbuttons\obj\Debug

     目录          0  2009-08-26 14:36  thirdbuttons\thirdbuttons\bin\Debug

     目录          0  2009-08-26 14:36  thirdbuttons\thirdbuttons\Properties

     目录          0  2009-08-26 14:36  thirdbuttons\thirdbuttons\obj

     目录          0  2009-08-26 14:36  thirdbuttons\thirdbuttons\bin

     目录          0  2009-08-26 14:36  thirdbuttons\thirdbuttons

     目录          0  2009-08-26 14:36  thirdbuttons

----------- ---------  ---------- -----  ----

               108228                    20


评论

共有 条评论