• 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.
  • Posts

    • So many things to unpack here I don't know where to begin...
    • Cjam 1.9.9.0 by Razvan Serea Cjam is a lightweight and fast MP3 editor for Windows that lets you cut, join, and edit MP3 files without re-encoding. This means your audio quality remains untouched, and edits happen instantly. Cjam is ideal for quick, lossless edits—whether you're trimming music, combining tracks, or preparing audio for learning tools or podcasts. It features batch processing, scripting support, cue and playlist file handling, and a simple interface. Cjam is perfect for anyone who needs efficient MP3 editing without the complexity of full audio suites. Cjam requires a PC running Windows 10 or later and Microsoft .NET 6.0 or later. Key features for Cjam: No Re-encoding: Edit MP3 files without losing quality. Cut and Join MP3: Easily cut, trim, and combine MP3 tracks. Batch Processing: Edit multiple files at once for faster workflows. Scriptable Interface: Automate tasks with a custom command language. Cue and Playlist Support: Handle CUE and playlist files for seamless audio management. Fast and Lightweight: Quick processing with minimal system resources. Lossless Audio Editing: Ensure your edits don't affect audio quality. Simple User Interface: Clean, intuitive design for easy navigation. File Format Support: Works with MP3, Cjam-specific file formats (CJAMC, CJAMJ, CJAM). Cjam 1.9.9.0 fixes: Fixed a bug related to playback display on the main screen Download: Cjam 1.9.9.0 | 1.3 MB (Freeware) Links: Cjam Home Page | Cjam Manual | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • "Users may experience repeated KERNEL_SECURITY_CHECK_FAILURE bugchecks after upgrading to this build." This "showstopper" bug/issue is still present for Dev 26200.5651, so NOT QUITE the June 2025 Snapshot for 26200 release but I think we are close to that release so should be within the next couple releases!
    • ah the "quest for more money" continues 🤣
    • Don’t underestimate marijuana because nothing else soothes souls. 
  • Recent Achievements

    • One Month Later
      jezzzy earned a badge
      One Month Later
    • First Post
      CSpera earned a badge
      First Post
    • One Month Later
      MIR JOHNNY BLAZE earned a badge
      One Month Later
    • Apprentice
      Wireless wookie went up a rank
      Apprentice
    • Week One Done
      bukro earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      635
    2. 2
      ATLien_0
      283
    3. 3
      +FloatingFatMan
      183
    4. 4
      Michael Scrip
      152
    5. 5
      Steven P.
      118
  • Tell a friend

    Love Neowin? Tell a friend!