你的位置:首页 > 软件开发 > ASP.net > 自己开发基于c#的垂直滚动条控件

自己开发基于c#的垂直滚动条控件

发布时间:2015-04-25 01:03:16
由于Visual Studio工具箱中自带滚动条控件外观太老,而且没有颜色外观属性可设置。 所以自己就试着开发一个垂直的滚动条,它可以用来控制TextBox的滚动。由于代码比较多,源文件已经打包到网盘,链接:http://pan.baidu.com/s/1dDtn8sD ...

由于Visual Studio工具箱中自带滚动条控件外观太老,而且没有颜色外观属性可设置。 所以自己就试着开发一个垂直的滚动条,它可以用来控制TextBox的滚动。

由于代码比较多,源文件已经打包到网盘,链接:http://pan.baidu.com/s/1dDtn8sD                   

 

Release目录下生成的dll可以添加至工具箱

使用时需要设置的属性:        

    #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

 


 

例如:

在属性浏览器中设置:

自己开发基于c#的垂直滚动条控件

 


 

设计器自动生成如下代码:

在Form类中:

 private MyControlLibrary.ScrollBar TextScrollBar;

原标题:自己开发基于c#的垂直滚动条控件

关键词:C#

C#
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录