private void AddVerticalScrollbar() { if (VerticalScrollbar != null) { RemoveVerticalScrollbar(); } VerticalScrollbar = new ScrollbarControl(this.Name + "VScrollbar"); VerticalScrollbar.Anchor = Anchor.Right | Anchor.Top | Anchor.Bottom; VerticalScrollbar.Orientation = Orientation.Vertical; VerticalScrollbar.Height = Panel.Height; VerticalScrollbar.Width = scrollbarWidth; if (Panel.Parent != null) { Panel.AttachControl(VerticalScrollbar.Control); } Panel.VerticalScrollbar = VerticalScrollbar.Control; }
private void AddHorizontalScrollbar() { if (HorizontalScrollbar != null) { RemoveHorizontalScrollbar(); } HorizontalScrollbar = new ScrollbarControl(this.Name + "HScrollbar"); HorizontalScrollbar.Anchor = Anchor.Bottom | Anchor.Left | Anchor.Right; HorizontalScrollbar.Orientation = Orientation.Horizontal; HorizontalScrollbar.Width = Panel.Width; HorizontalScrollbar.Height = scrollbarWidth; if (Panel.Parent != null) { Panel.Parent.AttachControl(HorizontalScrollbar.Control); } Panel.HorizontalScrollbar = HorizontalScrollbar.Control; }