private void SetupScrollBar()
{
if (inUpdate) return;
if (Orientation == MetroScrollOrientation.Vertical)
{
thumbWidth = Width > 0 ? Width : 10;
thumbHeight = GetThumbSize();
clickedBarRectangle = ClientRectangle;
clickedBarRectangle.Inflate(-1, -1);
thumbRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, thumbWidth, thumbHeight);
thumbPosition = thumbRectangle.Height/2;
thumbBottomLimitBottom = ClientRectangle.Bottom;
thumbBottomLimitTop = thumbBottomLimitBottom - thumbRectangle.Height;
thumbTopLimit = ClientRectangle.Y;
}
else
{
thumbHeight = Height > 0 ? Height : 10;
thumbWidth = GetThumbSize();
clickedBarRectangle = ClientRectangle;
clickedBarRectangle.Inflate(-1, -1);
thumbRectangle = new Rectangle(ClientRectangle.X, ClientRectangle.Y, thumbWidth, thumbHeight);
thumbPosition = thumbRectangle.Width/2;
thumbBottomLimitBottom = ClientRectangle.Right;
thumbBottomLimitTop = thumbBottomLimitBottom - thumbRectangle.Width;
thumbTopLimit = ClientRectangle.X;
}
ChangeThumbPosition(GetThumbPosition());
Refresh();
}