• 0

[c#] scrollbar colors/style


Question

Yes, I am back with another problems google failed to help me on :( I have a form with autoscroll enabled...which is how i would prefer it (though if push comes to shove...i can put in my own scroll bar)...

The default look to the scroll bar does not fit my app at all...i would like to be able to make it flat style, or at least change its colors...

the System.Windows.Forms.ScrollBar.(color stuff) is all read only, and i probably wouldnt want to change those anyways (i dont know if itd mess up my systems actualy color settings?)...but being flat and changing the color of it would be great...

but from what i can tell...unless i built my own scroll bar from scratch...i cant do this :( Is there some nice way of doing it?

Thanks once again!!

-Doug

Link to comment
https://www.neowin.net/forum/topic/282516-c-scrollbar-colorsstyle/
Share on other sites

8 answers to this question

Recommended Posts

  • 0
  gameguy said:
Both ScrollBar.BackColor and ScrollBar.ForeColor are read and write (Y)

585435710[/snapback]

How would I access those? Those do not exist in System.Windows.Forms.ScrollBar ...or is this if I put my own scrollbar in, i get more properties than autoscroll to change? can you give an example? I tried putting in my own scroll bar too and I didnt see backcolor or forecolor...

thanks

  • 0
  SkyyPunk said:
How would I access those?  Those do not exist in System.Windows.Forms.ScrollBar ...or is this if I put my own scrollbar in, i get more properties than autoscroll to change?  can you give an example?  I tried putting in my own scroll bar too and I didnt see backcolor or forecolor...

thanks

585436178[/snapback]

It's really odd you can't see the properties. They are there, and they are both get/set.

<edit>OK. You can't see them in design time, but you can set the colors at runtime.

<edit 2>

Uh... well, they sure are insistent that they stay the some color. You'll probably have to do all your own painting. Or you could subclass the scrollbars, and set the style to user paint ORed with AllPaintingInWmPaint. Maybe that will help.

Edited by weenur
  • 0
  Menge said:
  .Net 1.1 Documentation said:
You typically do not inherit directly from ScrollBar. To create your own scroll bar class, inherit from the VScrollBar or HScrollBar class.

Inherit the VScrollBar or the HScrollBar instead :)

585438439[/snapback]

That's what I meant, but I guess I should be more explicit.

  • 0

well...i think i am going to put this off for now...i already had enough fun making my own button class modifications...

I set the forecolors/backcolors of it, and i thought maybe it ignored it like mdiparents ignore backcolor and take it from the system default...so i did what i did to get my parent forms backcolor changed...didnt work...i then put up a messagebox displaying what it said was set for its backcolor and forecolor...sure enough it said what i set it to, but the scrollbar did not use those apparently...(i guess similar to its backgroundimage and alike...)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.