private void RefreshScrollbar() { if (ScrolledControl != null) { if (m_scrollbarV != null) { m_scrollbarV.Visible = m_scrolledArea.Size.Y < ScrolledControl.Size.Y; if (m_scrollbarV.Visible) { m_scrollbarV.Init(ScrolledControl.Size.Y, m_scrolledArea.Size.Y); var posTopRight = Size * new Vector2(0.5f, -0.5f); var position = new Vector2(posTopRight.X - m_scrollbarV.Size.X, posTopRight.Y); m_scrollbarV.Layout(position + new Vector2(0.0f, m_scrolledAreaPadding.Top), m_scrolledArea.Size.Y); } else { m_scrollbarV.Value = 0f; } } if (m_scrollbarH != null) { m_scrollbarH.Visible = m_scrolledArea.Size.X < ScrolledControl.Size.X; if (m_scrollbarH.Visible) { m_scrollbarH.Init(ScrolledControl.Size.X, m_scrolledArea.Size.X); var posBottomLeft = Size * new Vector2(-0.5f, 0.5f); var position = new Vector2(posBottomLeft.X, posBottomLeft.Y - m_scrollbarH.Size.Y + ScrollBarOffset.Y); m_scrollbarH.Layout(position + new Vector2(m_scrolledAreaPadding.Left), m_scrolledArea.Size.X); } else { m_scrollbarH.Value = 0f; } } } else { if (m_scrollbarV != null) { m_scrollbarV.Visible = false; } if (m_scrollbarH != null) { m_scrollbarH.Visible = false; } } RefreshScrolledControlPosition(); }