C# 更换控制装置';用一个新的滚动条

C# 更换控制装置';用一个新的滚动条,c#,winforms,combobox,textbox,scrollbar,C#,Winforms,Combobox,Textbox,Scrollbar,通过,我的工具箱中现在有一个新的滚动条控件,该控件继承自控件类,并具有以下代码。如何在当前控件(如组合框或多行文本框)中替换它 public class MetroScrollBar : Control, IMetroControl { public MetroScrollBar(); public MetroScrollBar(MetroScrollOrientation orientation); public MetroScrollBar(MetroScrollOr

通过,我的工具箱中现在有一个新的
滚动条
控件,该控件继承自
控件
类,并具有以下代码。如何在当前控件(如
组合框
或多行
文本框
)中替换它

public class MetroScrollBar : Control, IMetroControl
{
    public MetroScrollBar();
    public MetroScrollBar(MetroScrollOrientation orientation);
    public MetroScrollBar(MetroScrollOrientation orientation, int width);

    [Category("Metro Appearance")]
    [DefaultValue(false)]
    public bool HighlightOnWheel { get; set; }
    [DefaultValue(5)]
    public int LargeChange { get; set; }
    public int Maximum { get; set; }
    public int Minimum { get; set; }
    public int MouseWheelBarPartitions { get; set; }
    public MetroScrollOrientation Orientation { get; set; }
    [Category("Metro Appearance")]
    public int ScrollbarSize { get; set; }
    [DefaultValue(1)]
    public int SmallChange { get; set; }
    [Category("Metro Appearance")]
    public MetroColorStyle Style { get; set; }
    [Browsable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public MetroStyleManager StyleManager { get; set; }
    [Category("Metro Appearance")]
    public MetroThemeStyle Theme { get; set; }
    [Category("Metro Appearance")]
    [DefaultValue(false)]
    public bool UseBarColor { get; set; }
    [Category("Metro Appearance")]
    [DefaultValue(false)]
    public bool UseCustomBackColor { get; set; }
    [Browsable(false)]
    [Category("Metro Appearance")]
    [DefaultValue(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public bool UseCustomForeColor { get; set; }
    [Browsable(false)]
    [Category("Metro Behaviour")]
    [DefaultValue(false)]
    public bool UseSelectable { get; set; }
    [Browsable(false)]
    [Category("Metro Appearance")]
    [DefaultValue(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public bool UseStyleColors { get; set; }
    [Browsable(false)]
    [DefaultValue(0)]
    public int Value { get; set; }

    [Category("Metro Appearance")]
    public event EventHandler<MetroPaintEventArgs> CustomPaint;
    [Category("Metro Appearance")]
    public event EventHandler<MetroPaintEventArgs> CustomPaintBackground;
    [Category("Metro Appearance")]
    public event EventHandler<MetroPaintEventArgs> CustomPaintForeground;
    public event ScrollEventHandler Scroll;

    [SecuritySafeCritical]
    public void BeginUpdate();
    [SecuritySafeCritical]
    public void EndUpdate();
    public bool HitTest(Point point);
    protected virtual void OnCustomPaint(MetroPaintEventArgs e);
    protected virtual void OnCustomPaintBackground(MetroPaintEventArgs e);
    protected virtual void OnCustomPaintForeground(MetroPaintEventArgs e);
    protected override void OnEnabledChanged(EventArgs e);
    protected override void OnEnter(EventArgs e);
    protected override void OnGotFocus(EventArgs e);
    protected override void OnKeyDown(KeyEventArgs e);
    protected override void OnKeyUp(KeyEventArgs e);
    protected override void OnLeave(EventArgs e);
    protected override void OnLostFocus(EventArgs e);
    protected override void OnMouseDown(MouseEventArgs e);
    protected override void OnMouseEnter(EventArgs e);
    protected override void OnMouseLeave(EventArgs e);
    protected override void OnMouseMove(MouseEventArgs e);
    protected override void OnMouseUp(MouseEventArgs e);
    protected override void OnMouseWheel(MouseEventArgs e);
    protected override void OnPaint(PaintEventArgs e);
    protected override void OnPaintBackground(PaintEventArgs e);
    protected virtual void OnPaintForeground(PaintEventArgs e);
    protected override void OnSizeChanged(EventArgs e);
    protected override bool ProcessDialogKey(Keys keyData);
    protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified);
}
公共类MetroScrollBar:控件,IMetroControl
{
公共MetroScrollBar();
公共地铁滚动条(地铁定向);
公共MetroScrollBar(MetroScrollOrientation方向,整数宽度);
[类别(“地铁外观”)]
[默认值(false)]
公共bool HighlightOnWheel{get;set;}
[默认值(5)]
public int LargeChange{get;set;}
公共整数最大值{get;set;}
公共整数最小值{get;set;}
public int mouseweelbarpartitions{get;set;}
公共MetrosCrollorOrientation方向{get;set;}
[类别(“地铁外观”)]
public int ScrollbarSize{get;set;}
[默认值(1)]
公共int SmallChange{get;set;}
[类别(“地铁外观”)]
公共MetroColorStyle样式{get;set;}
[可浏览(错误)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
公共MetroStyleManager样式管理器{get;set;}
[类别(“地铁外观”)]
公共MetroThemeStyle主题{get;set;}
[类别(“地铁外观”)]
[默认值(false)]
公共bool UseBarColor{get;set;}
[类别(“地铁外观”)]
[默认值(false)]
公共bool UseCustomBackColor{get;set;}
[可浏览(错误)]
[类别(“地铁外观”)]
[默认值(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
公共bool UseCustomForeColor{get;set;}
[可浏览(错误)]
[类别(“地铁行为”)]
[默认值(false)]
公共布尔值{get;set;}
[可浏览(错误)]
[类别(“地铁外观”)]
[默认值(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
公共bool useStyleColor{get;set;}
[可浏览(错误)]
[默认值(0)]
公共int值{get;set;}
[类别(“地铁外观”)]
公共事件处理程序;
[类别(“地铁外观”)]
公共事件事件处理程序;
[类别(“地铁外观”)]
公共事件事件处理程序;
公共事件滚动事件处理程序滚动;
[安全性安全关键]
public void BeginUpdate();
[安全性安全关键]
public void EndUpdate();
公共bool HitTest(Point-Point);
定制时受保护的虚拟空隙(MetroPaintEventArgs e);
定制背景上受保护的虚拟空间(MetroPaintEventArgs e);
定制前台的受保护虚拟空间(MetroPaintEventArgs e);
受保护的覆盖无效OnEnabledChanged(事件参数e);
受保护的覆盖无效单(事件参数e);
受保护的超控无效OnGotFocus(事件参数e);
受保护的覆盖无效OnKeyDown(KeyEventArgs e);
受保护的覆盖无效OnKeyUp(KeyEventArgs e);
受保护的覆盖void OnLeave(事件参数e);
受保护的覆盖无效OnLostFocus(事件参数e);
MouseEventArgs e上的受保护覆盖无效;
在MouseCenter上受保护的覆盖无效(事件参数e);
在MouseLeave上受保护的覆盖无效(事件参数e);
MouseMove上的受保护覆盖无效(MouseEventArgs e);
MouseUp上的受保护覆盖无效(MouseEventArgs e);
鼠标滚轮上的受保护超控无效(MouseEventArgs e);
受保护的覆盖无效OnPaint(PaintEventArgs e);
PaintBackground上的受保护覆盖无效(PaintEventArgs e);
在PaintForeground(PaintEventArgs e)上受保护的虚拟空间;
IzeChanged上的受保护覆盖无效(事件参数e);
受保护的覆盖布尔ProcessDialogKey(Keys keyData);
受保护的覆盖无效SetBoundsCore(整数x、整数y、整数宽度、整数高度、指定的边界);
}

您找到解决方案了吗?我也面临同样的问题。你找到解决办法了吗?@MaryJune没有,不幸的是还没有。