Hi James,
Does this issue same as your another issue in the windowsforms.controls
group titiled "How can I change the color of a datagrid scrollbar" ?
If they are same issue, I'll follow up with you in this thread.
There is no managed way to change the the background color of the scrollbar.
however we may handle the win32 message WM_CTLCOLORSCROLLBAR to change the
background color. Here is a list of steps to do this:
1. define a derived class from DataGrid
2. override WndProc and handle the WM_CTLCOLORSCROLLBAR messge.
like below:
<code>
protected override void WndProc(ref Message m)
{
const int WM_CTLCOLORSCROLLBAR = 0x0137;
const int BLACK_BRUSH = 4;
if (m.Msg == WM_CTLCOLORSCROLLBAR && m.LParam == this.VertScrollBar.Handle)
{
m.Result = GetStockObject(BLACK_BRUSH);
return;
}
base.WndProc (ref m);
}
</code>
according to the doc of this message, you need return a HBRUSH handle , you
may create your brush object by pinvoke GDI APIs, however you need delete
them when they are no longer needed.
For arrows, I haven't found a way to customize the color, I'll go on
research it for a while and post an update for this thread.
Thanks!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.