Is it possible to change the background color of a VscrollBar? The best approach I have consulted is http://www.codeproject.com/Articles/624997/Enhanced-Scrollbar or http://www.codeproject.com/Articles/41869/Custom-Drawn-Scrollbar , but no exists BackColor property, and BackgroundImage not works.
I tried the simplest thing like:
public class ScrollBarEx : VScrollBar
{
protected override void OnPaint(PaintEventArgs e)
{
base.BackColor = Color.Red;
base.Invalidate();
}
}
It does not work. Any suggestions?
没有太多新信息,但是:您必须处理Paint
事件并做滚动条的自定义绘制,这是此解决方案的另一个链接(通过Paint
事件进行自定义绘制) http://www.codeproject.com/Articles/14801 /如何对皮肤的滚动条换面板,在-C
I built my own custom ScrollBar control based on http://www.codeproject.com/Articles/41869/Custom-Drawn-Scrollbar .
My custom ScrollBar comes with ready-to-use themes (VS 2019 Dark and VS 2019 Light). You can change the control background color by modifying the field _backColor or you can expose this private field with a property to allow you to change the background color from the code.
I have modified the original control to get rid of the 3D colors and replaced them with flat colors
Complete Flat ScrollBar control code in VB.NET https://gist.github.com/ahmedosama007/c1b0cd327d395a5698c1e17e96d0f8f9
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.