|
| Painting my own scroll bars |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.dotnet.framework.windowsforms.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
| Dragon |
Does anybody know I can override the drawing of scroll bars within a WinForms app. That's to say, where ever windows (within the app) puts a scroll bar (H or V), on forms or controls, I need to draw my own scoll bar.
Does anybody know if possible?, and how?, Any examples?
|
|
|
| |
|
| |
| |
| Roy (VIP) |
I created a UserControl, put a scrollbar in it, covered the scroll buttons with my own buttons, adjusted the width of the scroll bar to suit my "Touch Screen" needs, anchored the scrollbar & buttons within the UserControl, and defined / implemented an IScrollable interface. Additionally, I had to set AutoScroll to false and associate the control I wanted to scroll with my UserControl-based ScrollBar. Each control then had to implement my IScrollable interrface.
By using the existing VScrollBar I didn't have to implement the sizing logic of the bar itself, yet I had some control over the rendering of it.
Perhaps it was not the most elegant way of doing it, but I was new to .Net and User Interface development.
This was not as straightforward as I thought. How did you want to change the look?
"Dragon" wrote:
[Original message clipped]
|
|
|
| |
|
|
| |
| |
| Dragon |
I need to paint it my self (need to change it's color for starters) And, unfortunately, I can't do something like that, or rather it would be difficult, because I need to control all the scroll bars on the form, including ones which .NET brings up (e.g. scroll bar in listbox)..
The best guess I've got, is to tap into the message queue and trap the all the paint events (WM_PAINT), and if they are going to a scroll bar, do something else.. But that sounds messy.
"Roy" <Click here to reveal e-mail address> wrote in message news:Click here to reveal e-mail address... > I created a UserControl, put a scrollbar in it, covered the scroll buttons with my own buttons, adjusted the width of the scroll bar to suit my "Touch Screen" needs, anchored the scrollbar & buttons within the UserControl, and defined / implemented an IScrollable interface. Additionally, I had to set AutoScroll to false and associate the control I wanted to scroll with my UserControl-based ScrollBar. Each control then had to implement my IScrollable interrface. [Original message clipped]
|
|
|
| |
|
|
| |
| |
| Roy (VIP) |
If you have some money to throw at the problem, check out
http://www.SyncFusion.com
They have a nice library of .Net controls, available w/ full source. Their Essential Grid can do anything, including sharing external scrollbars. They derive a ScrollControl from the System.Windows.Forms.Control class where they provide support for shared scrollbars. Their ScrollControl class also provides support for auto-scrolling just like the System.Windows.Forms.ScrollableControl.
I've been a satisfied customer of theirs for two years now. There are lots of classes to learn in the Essential Suite, but the controls are ready-to-use and the support is excellent.
-Roy
|
|
|
| |
|
|
| |
|
| |
| Roy (VIP) |
I started by looking at the ScrollableControl class and soon became frustrated by the way the scrollbars were "insulated" by my attempts to customize the look of the scrollbars. Maybe there is some reliance on the Win32 api for some window rendering code... I don't know.
I found it easier to go the UserControl route, wrapping a VScrollBar and a couple of buttons into it, and disabling the AutoScroll property for the ScrollablreControl-derived classes I use. If you are more comfortable with the Win32 API than .Net you may have better luck than I down that path.
Good luck!
-Roy
"Dragon" wrote:
[Original message clipped]
|
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|