Skinnable Scrollbars?

Hi Walter...
I am wanting to create my own scrollbars with my own custom painting, but by the looks of it it is not possible to repaint them as I cannot find any methods to override.
Is there a way of doing this.. By either..
A) Overriding something?
B) Just increase the size of both GoOverview and GoView so the Scrollable control can function as it is needed?
Many Thanks in Advance,
Phil

If your custom control inherits from System.Windows.Forms.HScrollBar, you can just set GoView.HorizontalScrollBar. The same goes for VScrollBar and GoView.VerticalScrollBar.

If your custom control doesn't inherit from the standard xScrollBar classes, then you can set those two GoView properties to null and then set the GoView.BottomBar and RightBar properties to instances of your control. GoView will automatically stretch and position them, as it does for the regular scrollbars. But you'll need to implement GoView.PropertyChanged event handlers to keep your custom controls up-to-date with the GoView.DocPosition and GoView.DocScale properties.

although I cant test it yet, it looks it might just work

Hi,

I have implemented both scrollable controls..
Sadly the custom controls are not scretched as expected, the controls are simply replaced and sadly that is all.
If i change the scrollbars nothing happens, the model is not effected

As a test, I just defined a CustomHScrollBar inheriting from HScrollBar, and then set my view’s HorizontalScrollBar property to an instance of this control. Everything worked as I believe you would expect.

If you aren't inheriting from ScrollBar, that's OK too. For example, it's common to set the GoView.TopBar and .LeftBar to instances of Northwoods.Go.Draw.GoRuler. GoRuler just inherits from System.Windows.Forms.Control, not from ScrollBar.
But if your "bar" doesn't inherit from ScrollBar, GoView won't add the event handlers needed to scroll automatically when the user manipulates the ScrollBar, nor will it update the properties of the ScrollBar as the view's document extent changes. You'll need to implement your own functionality to do so, just as GoRuler does.

Thank you,

I am using the BottomBar and the RightBar attributes, as you mention in the your earlier post... (see below your a pasted in version)
what items should i override in GoView / GoOverView to keep the scrollbars consistant with the bars themselves?
----------------------------- Your Previous Post -----------------------------------
If your custom control doesn't inherit from the standard xScrollBar classes, then you can set those two GoView properties to null and then set the GoView.BottomBar and RightBar properties to instances of your control. GoView will automatically stretch and position them, as it does for the regular scrollbars. But you'll need to implement GoView.PropertyChanged event handlers to keep your custom controls up-to-date with the GoView.DocPosition and GoView.DocScale properties.
Thanks
Phil

You shouldn’t have to do anything. By default setting the GoView.HorizontalScrollBar property also changes the GoView.BottomBar property, since they refer to the same HScrollBar control.

Ah I remember being here before…

GoView.HorizontalScrollBar doesn't derive from Scrollbar, that is why I need to use BottomBar
Does that help any?
Thanks
Phil

By default the value of GoView.HorizontalScrollBar is a System.Windows.Forms.HScrollBar, which does inherit from ScrollBar.

By default the value of GoView.HorizontalScrollBar is the same Control as the value of GoView.BottomBar.
The same is true for GoView.VerticalScrollBar, VScrollBar, and GoView.RightBar.
I don't understand why you are having any problems. To test this, I defined a CustomHScrollBar class inheriting from HScrollBar. All I did in the constructor was to specify a value for Height.
Then in the initialization of my GoView, I assigned GoView.HorizontalScrollBar to a new instance of CustomHScrollBar. When I ran the application, you could tell immediately that it had a different Height than normal, and that its Width adjusted automatically to match the GoView as the view was resized.
Hi Water..
The problem is I need my scrollbars skinned, which is why i need to use a scrollbar that doesn't inherit from scrollbar, I put my scrollbar on the BottomBar like you suggested
I also need to keep the same functionality as before, any ideas?
Thanks
Phil

Walter…

Here is a possible other idea...
Is it possible to show the WHOLE map, I mean enclose the map within a panel, so I can use the scrolling of a custom panel instead?
So I guess what im asking is...
Turn off any form of scrolling functionality on GoView
GoView must expand as needed within the panel
This may have the same result for me and maybe get round this problem that I feel may not be a simple fix
Thanks
Phil

Well, as I said earlier, GoRuler does not inherit from ScrollBar, but a GoRuler works fine as the GoView.BottomBar, if you don’t want the standard scrollbar there. It’s just that you need to implement a GoView.PropertyChanged event handler to keep track of changes to the GoView.DocPosition and GoView.DocScale properties.

Regarding your other idea, I think that would be easy to implement. Just set those two ...ScrollBar properties to null, and set the GoView.DocPosition and GoView.Size as needed. But I'm not sure that it will work very well, since there's a practical limit on the size of the GoView that you can have, and you'll lose some of the optimizations that we implement.

Hi, can you point me at a sample of where GoRuler is implemented as your GoRuler works?

Thanks
Phil

GoRuler is in the Northwoods.Go.Draw.dll assembly/namespace.

But you don't even need to use that to demonstrate that GoView resizes and repositions its ...Bars correctly:
Panel p = new Panel();
p.Height = 12;
p.BackColor = Color.LightGreen;
goView1.BottomBar = p;

Now I understand… im on about the scrolling… yes the bar appears in the correct place, sorry about the misunderstanding, im talking about keeping the scrollbar in sync with the godiagram view

Thanks
Phil

Thank you got it

Hi, i just needed sample of implemention with external srcollbar.