问题描述
- 在winfrom设计中listview的滚动条如何改变颜色
-
在网上找到了代码 protected override void OnPaint(PaintEventArgs e)
{
//Rectangle re = new Rectangle(this);
base.OnPaint(e); // Visual styles are not enabled.
if (!ScrollBarRenderer.IsSupported)
{
this.Parent.Text = "CustomScrollBar Disabled";
return;
} this.Parent.Text = "CustomScrollBar Enabled"; // Draw the scroll bar track.ScrollBarRenderer.DrawRightHorizontalTrack(e.Graphics, ClientRectangle, ScrollBarState.Normal); // Draw the thumb and thumb grip in the current state. ScrollBarRenderer.DrawRightHorizontalTrack() ScrollBarRenderer.DrawHorizontalThumb(e.Graphics, ClientRectangle, ScrollBarState.Normal); ScrollBarRenderer.DrawHorizontalThumbGrip(e.Graphics, ClientRectangle, ScrollBarState.Normal); // Draw the scroll arrows in the current state. ScrollBarRenderer.DrawArrowButton(e.Graphics, ClientRectangle, ScrollBarArrowButtonState.LeftNormal); ScrollBarRenderer.DrawArrowButton(e.Graphics, ClientRectangle, ScrollBarArrowButtonState.LeftNormal); } 看懂了一部分,但没发现在那儿可以更滚动条的颜色的。哪位大神知道该如何更改呢?原来滚动条是白色的,我想改成![图片说明](http://img.ask.csdn.net/upload/201605/17/1463454810_765264.png)这种颜色的,该怎样重绘listview呢?
解决方案
参考:http://blog.csdn.net/fhzh520/article/details/18408311
时间: 2024-11-03 21:17:59