locked
Title bar and Scroll bar RRS feed

  • Question

  • How would one change the background colors for either of these in code, without changing the properties of the desktop properties.
    Tuesday, August 8, 2006 12:16 PM

All replies

  • I'm not aware of any way to color the title bar short of taking over the rendering of the window itself.  The scroll bar (assuming it derives from ScrollBar) can be changed using the standard BackColor property.  However if the scrollbar appears in a list box or view or even through the use of ScrollableControl then you won't have access to the scroll bar to change it.

    Michael Taylor - 8/9/06

    Wednesday, August 9, 2006 1:18 PM
  •  

    Hi

      For this your have to create custom HScrollbar and VScroll bar's.

    this can be achived by.

    1. create the class derived from HScrollbar and VScrollbar.

    2. In Paint you can do what ever the thing you want.

     

    -Thanks

    Mahesh

     

    Wednesday, August 9, 2006 1:35 PM
  • OK, I think this would work for the scroll bar.

     

    But do you think I could take over the onpaint of the form and do something like this.

    brush = new SolidBrush(Color.FromArgb(179,196,157));

    e.Graphics.FillRectangle(brush, e.Bounds);

    Friday, August 11, 2006 12:53 PM
  • Could I do this, if I override the OnDrawItemEvent of the form

     

    brush = new SolidBrush(Color.FromArgb(179,196,157));

    e.Graphics.FillRectangle(brush, e.Bounds);

    Friday, August 11, 2006 12:55 PM
  • Hi there. You should start investigation from

     http://windowssdk.msdn.microsoft.com/en-us/library/system.windows.forms.visualstyles.visualstylerenderer.aspx

    or write VisualStyleRenderer to your C# code window and press F1.

    Good hunting :)

    Friday, August 11, 2006 4:08 PM