本身开发基于c#的垂直滚动条控件

因为Visual Studio工具箱中自带滚动条控件外观太老,并且没有颜色外观属性可设置。 因此本身就试着开发一个垂直的滚动条,它能够用来控制TextBox的滚动。浏览器

因为代码比较多,源文件已经打包到网盘,连接:http://pan.baidu.com/s/1dDtn8sD                   ide

 

Release目录下生成的dll能够添加至工具箱工具

使用时须要设置的属性:        this

        #region 滑动条最短长度
        [System.ComponentModel.Browsable(true)]
        [Localizable(true)]
        [System.ComponentModel.Category("Appearance")]
        [System.ComponentModel.DefaultValue(null)]
        [System.ComponentModel.Description("滑动条最短长度")]
        public int MinSlideBarLenght{get; set;}
        #endregion

#region 要滑动的TextBox [System.ComponentModel.Browsable(true)] [Localizable(true)] [System.ComponentModel.Category("Appearance")] [System.ComponentModel.DefaultValue(null)] [System.ComponentModel.Description("要滚动的TextBox")] public TextBox TextBox{get; set;} #endregion

#region 滑动条被唤醒颜色 [System.ComponentModel.Browsable(true)] [Localizable(true)] [System.ComponentModel.Category("Appearance")] [System.ComponentModel.Description("滑动条被唤醒的颜色")] [System.ComponentModel.DefaultValue(null)] public Color WakedColor{get; set;} #endregion

#region 滑动条被按下颜色 [System.ComponentModel.Browsable(true)] [Localizable(true)] [System.ComponentModel.Category("Appearance")] [System.ComponentModel.DefaultValue(null)] [System.ComponentModel.Description("滑动条被按下的颜色")] public Color PressedColor{get;set;} #endregion

#region 鼠标进入滑动条颜色 [System.ComponentModel.Browsable(true)] [Localizable(true)] [System.ComponentModel.Category("Appearance")] [System.ComponentModel.DefaultValue(null)] [System.ComponentModel.Description("鼠标进入滑动条的颜色")] public Color EnterColor {get; set;} #endregion

 


 

例如:spa

在属性浏览器中设置:设计

 


 

设计器自动生成以下代码:code

在Form类中:orm

  private MyControlLibrary.ScrollBar TextScrollBar;

在InitializeComponent()中:blog

            this.TextScrollBar.BackColor = System.Drawing.Color.White;
            this.TextScrollBar.EnterColor = System.Drawing.SystemColors.ControlDark;
            this.TextScrollBar.Location = new System.Drawing.Point(664, 44);
            this.TextScrollBar.MinSlideBarLenght = 30;
            this.TextScrollBar.Name = "TextScrollBar";
            this.TextScrollBar.PressedColor = System.Drawing.SystemColors.ControlDarkDark;
            this.TextScrollBar.Size = new System.Drawing.Size(10, 323);
            this.TextScrollBar.TabIndex = 18;
            this.TextScrollBar.TextBox = this.TextBox_Receive;
            this.TextScrollBar.WakedColor = System.Drawing.SystemColors.ControlLight;

 


 

效果图:ip

相关文章
相关标签/搜索