/// <summary> /// Required method for Designer support - do not modify the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this._horizontalScrollBar = new ModernScrollBar(); this._verticalScrollBar = new ModernScrollBar(); ((ISupportInitialize)this).BeginInit(); this.SuspendLayout(); this._horizontalScrollBar.LargeChange = 10; this._horizontalScrollBar.Location = new Point(0, 0); this._horizontalScrollBar.Maximum = 100; this._horizontalScrollBar.Minimum = 0; this._horizontalScrollBar.MouseWheelBarPartitions = 10; this._horizontalScrollBar.Name = "_horizontalScrollBar"; this._horizontalScrollBar.Orientation = ModernScrollBarOrientation.Horizontal; this._horizontalScrollBar.ScrollbarSize = 50; this._horizontalScrollBar.Size = new Size(200, 50); this._horizontalScrollBar.TabIndex = 0; this._horizontalScrollBar.UseSelectable = true; this._verticalScrollBar.LargeChange = 10; this._verticalScrollBar.Location = new Point(0, 0); this._verticalScrollBar.Maximum = 100; this._verticalScrollBar.Minimum = 0; this._verticalScrollBar.MouseWheelBarPartitions = 10; this._verticalScrollBar.Name = "_verticalScrollBar"; this._verticalScrollBar.Orientation = ModernScrollBarOrientation.Vertical; this._verticalScrollBar.ScrollbarSize = 50; this._verticalScrollBar.Size = new Size(50, 200); this._verticalScrollBar.TabIndex = 0; this._verticalScrollBar.UseSelectable = true; ((ISupportInitialize)this).EndInit(); this.ResumeLayout(false); }
/// <summary> /// Initializes a new instance of the <see cref="ModernDataGridViewHelper"/> class. /// </summary> /// <param name="scrollBar">The ModernScrollBar.</param> /// <param name="dataGridView">The DataGridView.</param> /// <param name="isVertical">Whether use vertical.</param> public ModernDataGridViewHelper(ModernScrollBar scrollBar, DataGridView dataGridView, bool isVertical = true) { this._scrollBar = scrollBar; this._scrollBar.UseBarColor = true; this._dataGridView = dataGridView; this._isVertical = isVertical; foreach (var item in this._dataGridView.Controls) { if (item.GetType() == typeof(VScrollBar)) { this._vScrollBar = (VScrollBar)item; } if (item.GetType() == typeof(HScrollBar)) { this._hScrollBar = (HScrollBar)item; } } this._dataGridView.RowsAdded += this.OnDataGridViewRowsAdded; this._dataGridView.UserDeletedRow += this.OnDataGridViewUserDeletedRow; this._dataGridView.Scroll += this.OnDataGridViewScroll; this._dataGridView.Resize += this.OnDataGridViewResize; this._scrollBar.Scroll += this.OnScrollBarScroll; this._scrollBar.ScrollbarSize = 17; this.UpdateScrollBar(); }
/// <summary> /// Initializes a new instance of the <see cref="ModernDataGridViewHelper"/> class. /// </summary> /// <param name="scrollBar">The ModernScrollBar.</param> /// <param name="dataGridView">The DataGridView.</param> /// <param name="isVertical">Whether use vertical.</param> public ModernDataGridViewHelper(ModernScrollBar scrollBar, DataGridView dataGridView, bool isVertical) { this._scrollBar = scrollBar; this._scrollBar.UseBarColor = true; this._dataGridView = dataGridView; this._isVertical = isVertical; foreach (object item in this._dataGridView.Controls) { if (item.GetType() == typeof(VScrollBar)) { this._vScrollBar = (VScrollBar)item; } if (item.GetType() == typeof(HScrollBar)) { this._hScrollBar = (HScrollBar)item; } } this._scrollBar.Scroll += this.OnScrollBarScroll; this.UpdateScrollBar(); }