private void CreateScrollBars() { if (_vScrollBar != null) { _vScrollBar.Dispose(); } if (_hScrollBar != null) { _hScrollBar.Dispose(); } var borderSize = BorderSize; var scrollWidth = SystemInformation.VerticalScrollBarWidth; if (LicenseManager.UsageMode == LicenseUsageMode.Runtime) { _vScrollBar = Style.CreateScrollBar(Orientation.Vertical); } else { _vScrollBar = new SystemScrollBarAdapter(Orientation.Vertical); } _vScrollBar.Maximum = 1; _vScrollBar.Minimum = 0; _vScrollBar.SmallChange = 1; _vScrollBar.LargeChange = 1; _vScrollBar.Control.Enabled = false; _vScrollBar.Control.Bounds = new Rectangle(Width - scrollWidth - borderSize, borderSize, scrollWidth, Height - borderSize * 2); _vScrollBar.Control.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; _vScrollBar.ValueChanged += OnVScrollBarValueChanged; _vScrollBar.Scroll += OnVScrollBarScroll; _vScrollBar.Control.MouseCaptureChanged += OnScrollBarCaptureChanged; _vScrollBar.Control.MouseDown += OnScrollBarMouseDown; var scrollHeight = SystemInformation.HorizontalScrollBarHeight; if (LicenseManager.UsageMode == LicenseUsageMode.Runtime) { _hScrollBar = Style.CreateScrollBar(Orientation.Horizontal); } else { _hScrollBar = new SystemScrollBarAdapter(Orientation.Horizontal); } _hScrollBar.Maximum = 1; _hScrollBar.Minimum = 0; _hScrollBar.SmallChange = 1; _hScrollBar.LargeChange = 1; _hScrollBar.Control.Enabled = false; _hScrollBar.Control.Bounds = new Rectangle(borderSize, Height - borderSize - scrollHeight, Width - borderSize * 2, scrollHeight); _hScrollBar.Control.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; _hScrollBar.ValueChanged += OnHScrollBarValueChanged; _hScrollBar.Scroll += OnHScrollBarScroll; _hScrollBar.Control.MouseCaptureChanged += OnScrollBarCaptureChanged; _hScrollBar.Control.MouseDown += OnScrollBarMouseDown; }
private void CreateScrollBars() { if(_vScrollBar != null) { _vScrollBar.Dispose(); } if(_hScrollBar != null) { _hScrollBar.Dispose(); } var borderSize = BorderSize; var scrollWidth = SystemInformation.VerticalScrollBarWidth; if(LicenseManager.UsageMode == LicenseUsageMode.Runtime) { _vScrollBar = Style.CreateScrollBar(Orientation.Vertical); } else { _vScrollBar = new SystemScrollBarAdapter(Orientation.Vertical); } _vScrollBar.Maximum = 1; _vScrollBar.Minimum = 0; _vScrollBar.SmallChange = 1; _vScrollBar.LargeChange = 1; _vScrollBar.Control.Enabled = false; _vScrollBar.Control.Bounds = new Rectangle(Width - scrollWidth - borderSize, borderSize, scrollWidth, Height - borderSize * 2); _vScrollBar.Control.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; _vScrollBar.ValueChanged += OnVScrollBarValueChanged; _vScrollBar.Scroll += OnVScrollBarScroll; _vScrollBar.Control.MouseCaptureChanged += OnScrollBarCaptureChanged; _vScrollBar.Control.MouseDown += OnScrollBarMouseDown; var scrollHeight = SystemInformation.HorizontalScrollBarHeight; if(LicenseManager.UsageMode == LicenseUsageMode.Runtime) { _hScrollBar = Style.CreateScrollBar(Orientation.Horizontal); } else { _hScrollBar = new SystemScrollBarAdapter(Orientation.Horizontal); } _hScrollBar.Maximum = 1; _hScrollBar.Minimum = 0; _hScrollBar.SmallChange = 1; _hScrollBar.LargeChange = 1; _hScrollBar.Control.Enabled = false; _hScrollBar.Control.Bounds = new Rectangle(borderSize, Height - borderSize - scrollHeight, Width - borderSize * 2, scrollHeight); _hScrollBar.Control.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; _hScrollBar.ValueChanged += OnHScrollBarValueChanged; _hScrollBar.Scroll += OnHScrollBarScroll; _hScrollBar.Control.MouseCaptureChanged += OnScrollBarCaptureChanged; _hScrollBar.Control.MouseDown += OnScrollBarMouseDown; }