• 大小: 406KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-06
  • 语言: 其他
  • 标签: 代码  Toolbox  c#  程序  

资源简介

仿VS2010风格的toolbox抽屉控件 (带源码)

资源截图

代码片段和文件信息

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

namespace MyControls2008
{
    public partial class Line : Control
    {
        public Line()
        {
            InitializeComponent();

            this.Pen = new Pen(this.color);
        }

        [Browsable(false)]
        private Point pointTl = new Point(0 0);
        [Browsable(false)]
        private Point pointBr = new Point(100 100);

        [Browsable(true)
        Category(“扩展“)
        Description(“左上坐标“)
        RefreshProperties(RefreshProperties.Repaint)
        NotifyParentProperty(true)]
        private Point PointTl
        {
            get
            {
                return pointTl;
            }
            set
            {
                pointTl = value;
                this.Invalidate();
            }
        }

        [Browsable(true)
        Category(“扩展“)
        Description(“右下坐标“)
        RefreshProperties(RefreshProperties.Repaint)
        NotifyParentProperty(true)]
        private Point PointBr
        {
            get
            {
                return pointBr;
            }
            set
            {
                pointBr = value;
                this.Invalidate();
            }
        }

        #region 控件框颜色
        [Browsable(false)]
        private Color color = Color.FromArgb(0 0 0);

        [Browsable(false)]
        private Pen Pen;

        [Browsable(true)
        Category(“扩展“)
        Description(“颜色“)
        RefreshProperties(RefreshProperties.Repaint)
        NotifyParentProperty(true)]
        public Color Color
        {
            get
            {
                return color;
            }
            set
            {
                color = value;
                Pen = new Pen(color);
                this.Invalidate();
            }
        }
        #endregion

        #region 重绘
        protected override void OnPaint(PaintEventArgs e)
        {
            this.NewPaint(e);
        }

        private void NewPaint(PaintEventArgs e)
        {
            e.Graphics.DrawLine(Pen PointTl PointBr);
            e.Graphics.Dispose();
        }
        #endregion

        private bool isLocation = false;
        protected override void OnLocationchanged(EventArgs e)
        {
            base.OnLocationchanged(e);

            this.isLocation = true;
        }
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);

            if (this.isLocation) {

            }
            else {
                this.pointBr = new Point(
                    this.pointTl.X + this.Width
                     this.pointTl.Y + this.Height);
            }

            this.isLocation = false;
        }
    }
}

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

     文件        259  2009-11-06 16:05  MyControls2008\ControlImage\launch.png

     文件        275  2009-11-06 15:07  MyControls2008\ControlImage\normal.png

     文件      29184  2009-11-13 19:36  MyControls2008\MyControls2008\bin\Debug\MyControls2008.dll

     文件      69120  2009-11-13 19:36  MyControls2008\MyControls2008\bin\Debug\MyControls2008.pdb

     文件      29184  2009-12-02 08:55  MyControls2008\MyControls2008\bin\Release\MyControls2008.dll

     文件      69120  2009-12-02 08:55  MyControls2008\MyControls2008\bin\Release\MyControls2008.pdb

     文件          1  2009-11-13 09:41  MyControls2008\MyControls2008\ClassDiagram1.cd

     文件       3035  2009-11-16 19:03  MyControls2008\MyControls2008\Line.cs

     文件       1188  2009-11-16 19:03  MyControls2008\MyControls2008\Line.Designer.cs

     文件       5814  2009-11-16 18:54  MyControls2008\MyControls2008\Line.resx

     文件       4733  2009-11-16 19:03  MyControls2008\MyControls2008\MyControls2008.csproj

     文件        956  2009-11-13 19:36  MyControls2008\MyControls2008\obj\Debug\MyControls2008.csproj.FileListAbsolute.txt

     文件       1058  2009-11-13 19:36  MyControls2008\MyControls2008\obj\Debug\MyControls2008.csproj.GenerateResource.Cache

     文件      29184  2009-11-13 19:36  MyControls2008\MyControls2008\obj\Debug\MyControls2008.dll

     文件      69120  2009-11-13 19:36  MyControls2008\MyControls2008\obj\Debug\MyControls2008.pdb

     文件       1248  2009-11-13 19:36  MyControls2008\MyControls2008\obj\Debug\MyControls2008.Properties.Resources.resources

     文件        180  2009-11-13 19:36  MyControls2008\MyControls2008\obj\Debug\MyControls2008.Toolbox.resources

     文件        180  2009-11-13 19:36  MyControls2008\MyControls2008\obj\Debug\MyControls2008.ToolboxGroup.resources

     文件       1876  2009-11-13 19:36  MyControls2008\MyControls2008\obj\Debug\MyControls2008.ToolboxItem.resources

     文件      10752  2009-11-13 15:55  MyControls2008\MyControls2008\obj\Debug\Refactor\MyControls2008.dll

     文件       4608  2009-11-11 21:59  MyControls2008\MyControls2008\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件       1073  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.csproj.FileListAbsolute.txt

     文件       1115  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.csproj.GenerateResource.Cache

     文件      29184  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.dll

     文件        180  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.Line.resources

     文件      69120  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.pdb

     文件       1248  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.Properties.Resources.resources

     文件        180  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.Toolbox.resources

     文件        180  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.ToolboxGroup.resources

     文件       1876  2009-12-02 08:55  MyControls2008\MyControls2008\obj\Release\MyControls2008.ToolboxItem.resources

............此处省略121个文件信息

评论

共有 条评论