Vertical Scrollbar color does not change

后端 未结 1 523
你的背包
你的背包 2021-01-29 08:01

I am a newbie in C sharp. I created a vertical scrollbar (VScrollBar). I wanted to change the color of the scrollbar\'s Backcolor. As it is inherited from Control, when i change

相关标签:
1条回答
  • 2021-01-29 08:23

    Not as simple as you might think, sorry :(

    Where does the Backcolor property come from?

    You have to understand that System.Windows.Forms.VScrollBar inherits from System.Windows.Forms.ScrollBar that inherits from System.Windows.Forms.Control that got a Backcolor property.

    Why doesn't it work?

    The System.Windows.Forms.ScrollBar is just a wrapper around the control provided by the Win32 API. Changing the Scrollbar Backcolor is not included there.

    What to do?

    Basicly you have to inherit from System.Windows.Forms.Control and create your own scrollbar control.

    Articles: http://www.codeproject.com/Articles/41869/Custom-Drawn-Scrollbar

    Yep, that is totally a reason why people prefer WPF.

    0 讨论(0)
提交回复
热议问题