RobinPerris / DarkUI

Dark themed control and docking library for .NET WinForms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

darkScrollBar Properties

ohhsodead opened this issue · comments

Woops, I never meant to submit this early.

Basically, how should I go about setting the scrollBar control properties to match those with, e.g. my flowLayoutPanel, so I can imitate its status. I currently have set the Minimum, Maximum and Value properties of the default winform scrollBar, but aren't able to figure out to get the ViewSize. Also, I'm assuming that the ValueChanged event should set the default scrollBar Value property, which works fine, I just cannot get scroll any further than a certain portion of the flowLayoutPanel area.

Thanks.

commented

The ViewSize property should match the viewable area of the control. This value is used in the scrollbar's internal calculations for sizing the area of the 'thumb' - the centre piece which gets dragged around as you scroll. It is also used for calculating the absolute position when using methods such as ScrollToPhysical()

You can see how the scrollbars are setup and managed in the DarkScrollBase control. This is what I use as the base class for any DarkUI control which needs to scroll.

private void SetVisibleSize()
{
var scrollSize = Consts.ScrollBarSize;
_visibleSize = new Size(ClientSize.Width, ClientSize.Height);
if (_vScrollBar.Visible)
_visibleSize.Width -= scrollSize;
if (_hScrollBar.Visible)
_visibleSize.Height -= scrollSize;
}

_vScrollBar.ViewSize = _visibleSize.Height;
_hScrollBar.ViewSize = _visibleSize.Width;

I've never personally tried to marry a DarkScrollBar with a stand-alone control such as a FlowLayoutPanel so I'm not sure if there are any subtleties or quirks. In theory you should be able to set the ViewSize to the Width and Height of the panel and it should work.

If not, let me know and I'll take a closer look.

Thank you very much for the fast response! All has been completed. With your project I'm finally able to design beautiful applications, so I really appreciate your work! Amazing stuff.

commented

I'm glad it's getting some use! Good luck in your project.

commented

So I'd like to add the DarkScrollBar to the DarkPanel or DarkSectionPanel control. Do I have to copy basically the whole DarkScrollBase to make this work?
How did you do this @ohhsodead?

@sp00n I added the DarkScrollBar separately and mimicked the original scrollbar properties to the dark one, such as the MaxValue, etc.