1

I've created a new class and inherited VScrollBar. I've created an override for OnPaint however it never fires. I've discovered VScrollBar is a wrapper for ScrollBar control, but I don't know how to work around this.

public class MyScrollBar : VScrollBar
{
    public IScrollBar()
    {
        this.SetStyle(ControlStyles.UserPaint, true);
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        base.OnPaint(e);
    }
}

The OnPaint is now being fired, but the scroll bar is not drawing correctly. The trigger arrows at the top and bottom are missing etc. Why can't I just create my class with inheriting VScrollBar and what are my optinos for creating this custom scrollbar.

The need to do this is I want to create a custom look and add bookmark type features. I can create a User Control BUT my question is why won't this work and how can I get it to work properly this way?

Aerith
  • 337
  • 3
  • 11
  • 1
    Have a look at this CodeProject article. He uses the `ScrollBarRenderer` to manuelly draw the arrows and such. It even includes bookmarks if you don't want to make your own ;). http://www.codeproject.com/Articles/624997/Enhanced-Scrollbar – Visual Vincent Mar 07 '15 at 09:48

0 Answers0