• 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

    • Mixed news. Glad to hear LibreOffice is catching up to MS's Office. The latter has become way too bloated/complicated and non-intuitive to non-power users. Apparently, MS no longer cares for the non-gaming home-based consumer. Sad to hear support for WIndows-7 is ending. Many users remain with Windows-7 as it was easy to use, intuitive, and reliable. Non-power users and gamers don't need to needless complexity, dubious "features," and long-term instability of the last few versions. [After "how many years" Windows-10 is now reasonably stable--as long as MS stops mucking with it.]
    • Yeah but Microsoft actually did a good job with Aero Glass. I remember the only complaints was about how people could not use it without a top tier card back in the day, it would also disable until you activated Windows. Aero Glass was used in window borders, taskbar and yes the Start menu, but only as a border reference, the programs in the Start menu had a black background on Start (if I remember correctly) and All Programs and context menus were not glass.
    • The only thing it looks like to me is harder to read.
    • I am surprised that the kid who got run over next to stop light did not sue...
    • Wine 10.10 released, brings updated Mono engine, bug fixes for several games, and more by David Uzondu Nearly two weeks after Wine 10.9 dropped, Wine 10.10 is here with an updated Mono engine and the complete removal of a major graphics dependency. The Wine Mono engine, which provides .NET Framework support, has been bumped to version 10.1.0. Another major change is the removal of the OSMesa library as a dependency. OpenGL rendering on memory device contexts will now be handled by a pbuffer, cleaning up the graphics stack. Here are other notable changes with this release: More support for generating Windows Runtime metadata in WIDL. Locale data updated to Unicode CLDR 47. P010 format support in Media Foundation. Of course, no development release would be complete without a boatload of bug fixes. This version crushes a total of 38 bugs, addressing problems in a wide range of applications and games. Gamers will be pleased to see fixes for titles like F.E.A.R., S.T.A.L.K.E.R.: Anomaly, and StarCraft Remastered. Issues that caused a black screen in Steam's Big Picture mode and crashes when starting a new game in F.E.A.R. have been resolved. The fixes go way back, even tackling issues in ancient software like Lotus Freelance Graphics 2.1 and input problems in the classic indie game Braid. Here's the full list of game-related issues addressed: Rise of Nations: Both mouse buttons were required for a single left-click Braid: Both Shift keys needed to move puzzle pieces F.E.A.R: Crashed with an "Out of memory" error when starting a new game F.E.A.R Combat: Black screen at startup due to memory error S.T.A.L.K.E.R. Anomaly: Crashed when loading into a save file StarCraft Remastered: Game wouldn't start with Wine 10.5 Unreal II: Hangs with a black screen when switching to 1440x900 resolution Eador. Masters of the Broken World: Bad map textures after starting the game Horizon Chase: Freezes on startup The Fidelio Incident and Vampyr: Beeping noise on exit Burger Shop: Shifted to the top left corner in fullscreen mode And here's the rest of the issues that were fixed: Lotus Freelance Graphics 2.1: Hangs at the splash screen HTML-Kit 292: Tab bar isn't fully visible without scrolling at 96 DPI Tab completion for cmd: Improvements made regedit: Binary values editor layout is broken and .reg files couldn’t be imported Baofeng5-5.31.1128: Welcome window crashes on start Canon printer driver installation now works Steam Big Picture mode: Fixed black screen when using d3d10 Noteworthy Composer: Crashes in winealsa resolved Ricoh Digital Camera Utility 5: Crashes when switching between Browser and Laboratory modes Wondershare Uniconverter 13: Characters now display properly AVCLabs Video Enhancer AI: No longer crashes on start New thread stack memory usage optimized PlayOnline Viewer: Window now properly activates after being minimized Virtual desktop behavior fixed secur32:ntlm tests now pass on Windows 11 24H2 d3d9:device WM_WINDOWPOSCHANGED test no longer fails on Linux GitLab CI no longer crashes in various multimedia tests HP Prime Virtual Calculator: Fixed startup crash Qt Installer for Windows: Now functions correctly SHIFT-based range selection logic corrected Creating 64-bit wineprefix with old wow64 now possible Regression from realloc switch fixed (memory now zeroed as expected) RTTI now works on arm32 after recent changes Smartsuite 3.1 installer no longer crashes Fixed possible use-after-free in dbghelp's symt_add_func_line Build issues with clang for x86_64 resolved due to RTTI changes You can read the full release notes here. The source code for this release is also available. To get started, follow the installation instructions for your platform: Ubuntu/Debian, Fedora, or macOS.
  • Recent Achievements

    • Week One Done
      Simmo3D earned a badge
      Week One Done
    • One Month Later
      Simmo3D earned a badge
      One Month Later
    • One Month Later
      greege earned a badge
      One Month Later
    • Week One Done
      greege earned a badge
      Week One Done
    • Week One Done
      LagFighterZ earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      547
    2. 2
      ATLien_0
      232
    3. 3
      +FloatingFatMan
      165
    4. 4
      Michael Scrip
      119
    5. 5
      +Edouard
      91
  • Tell a friend

    Love Neowin? Tell a friend!