#pragma warning restore 0414 #endif /// <include file='doc\DataGridView.uex' path='docs/doc[@for="DataGridView.DataGridView"]/*' /> /// <devdoc> /// <para>Initializes a new instance of the <see cref='System.Windows.Forms.DataGridView'/> class.</para> /// </devdoc> public DataGridView() { SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.UserMouse, true); SetStyle(ControlStyles.SupportsTransparentBackColor, false); // this class overrides GetPreferredSizeCore, let Control automatically cache the result SetState2(STATE2_USEPREFERREDSIZECACHE, true); this.dataGridViewState1 = new System.Collections.Specialized.BitVector32(0x00000000); this.dataGridViewState2 = new System.Collections.Specialized.BitVector32(0x00000000); this.dataGridViewOper = new System.Collections.Specialized.BitVector32(0x00000000); this.dataGridViewState1[ DATAGRIDVIEWSTATE1_columnHeadersVisible | DATAGRIDVIEWSTATE1_rowHeadersVisible | DATAGRIDVIEWSTATE1_autoGenerateColumns | DATAGRIDVIEWSTATE1_allowUserToAddRows | DATAGRIDVIEWSTATE1_allowUserToDeleteRows ] = true; this.dataGridViewState2[ DATAGRIDVIEWSTATE2_showEditingIcon | DATAGRIDVIEWSTATE2_enableHeadersVisualStyles | DATAGRIDVIEWSTATE2_mouseEnterExpected | DATAGRIDVIEWSTATE2_allowUserToResizeColumns | DATAGRIDVIEWSTATE2_allowUserToResizeRows | DATAGRIDVIEWSTATE2_showCellToolTips | DATAGRIDVIEWSTATE2_showCellErrors | DATAGRIDVIEWSTATE2_showRowErrors | DATAGRIDVIEWSTATE2_allowHorizontalScrollbar | DATAGRIDVIEWSTATE2_usedFillWeightsDirty ] = true; this.displayedBandsInfo = new DisplayedBandsData(); this.lstRows = new ArrayList(); this.converters = new Hashtable(8); this.pens = new Hashtable(8); this.brushes = new Hashtable(10); this.gridPen = new Pen(DefaultGridColor); this.selectedBandIndexes = new DataGridViewIntLinkedList(); this.individualSelectedCells = new DataGridViewCellLinkedList(); this.individualReadOnlyCells = new DataGridViewCellLinkedList(); this.advancedCellBorderStyle = new DataGridViewAdvancedBorderStyle(this, DataGridViewAdvancedCellBorderStyle.OutsetDouble, DataGridViewAdvancedCellBorderStyle.OutsetPartial, DataGridViewAdvancedCellBorderStyle.InsetDouble); this.advancedRowHeadersBorderStyle = new DataGridViewAdvancedBorderStyle(this); this.advancedColumnHeadersBorderStyle = new DataGridViewAdvancedBorderStyle(this); this.advancedCellBorderStyle.All = defaultAdvancedCellBorderStyle; this.advancedRowHeadersBorderStyle.All = defaultAdvancedRowHeadersBorderStyle; this.advancedColumnHeadersBorderStyle.All = defaultAdvancedColumnHeadersBorderStyle; this.borderStyle = defaultBorderStyle; this.dataGridViewState1[DATAGRIDVIEWSTATE1_multiSelect] = true; this.selectionMode = defaultSelectionMode; this.editMode = defaultEditMode; this.autoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; this.autoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; this.columnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; this.rowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing; this.clipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithAutoHeaderText; this.layout = new LayoutData(); this.layout.TopLeftHeader = Rectangle.Empty; this.layout.ColumnHeaders = Rectangle.Empty; this.layout.RowHeaders = Rectangle.Empty; this.layout.ColumnHeadersVisible = true; this.layout.RowHeadersVisible = true; this.layout.ClientRectangle = this.ClientRectangle; this.scrollBars = ScrollBars.Both; this.horizScrollBar.RightToLeft = RightToLeft.Inherit; this.horizScrollBar.AccessibleName = SR.GetString(SR.DataGridView_AccHorizontalScrollBarAccName); this.horizScrollBar.Top = this.ClientRectangle.Height - horizScrollBar.Height; this.horizScrollBar.Left = 0; this.horizScrollBar.Visible = false; this.horizScrollBar.Scroll += new ScrollEventHandler(DataGridViewHScrolled); this.Controls.Add(this.horizScrollBar); this.vertScrollBar.Top = 0; this.vertScrollBar.AccessibleName = SR.GetString(SR.DataGridView_AccVerticalScrollBarAccName); this.vertScrollBar.Left = this.ClientRectangle.Width - vertScrollBar.Width; this.vertScrollBar.Visible = false; this.vertScrollBar.Scroll += new ScrollEventHandler(DataGridViewVScrolled); this.Controls.Add(this.vertScrollBar); this.ptCurrentCell = new Point(-1, -1); this.ptAnchorCell = new Point(-1, -1); this.ptMouseDownCell = new Point(-2, -2); this.ptMouseEnteredCell = new Point(-2, -2); this.ptToolTipCell = new Point(-1, -1); this.ptMouseDownGridCoord = new Point(-1, -1); this.sortOrder = SortOrder.None; this.lastMouseClickInfo.timeStamp = 0; WireScrollBarsEvents(); PerformLayout(); this.toolTipControl = new DataGridViewToolTip(this); Invalidate(); }
public DataGridView() { base.SetStyle(ControlStyles.UserMouse | ControlStyles.Opaque | ControlStyles.UserPaint, true); base.SetStyle(ControlStyles.SupportsTransparentBackColor, false); base.SetState2(0x800, true); this.dataGridViewState1 = new BitVector32(0); this.dataGridViewState2 = new BitVector32(0); this.dataGridViewOper = new BitVector32(0); this.dataGridViewState1[0x80001b] = true; this.dataGridViewState2[0x60003e7] = true; this.displayedBandsInfo = new DisplayedBandsData(); this.lstRows = new ArrayList(); this.converters = new Hashtable(8); this.pens = new Hashtable(8); this.brushes = new Hashtable(10); this.gridPen = new Pen(DefaultGridColor); this.selectedBandIndexes = new DataGridViewIntLinkedList(); this.individualSelectedCells = new DataGridViewCellLinkedList(); this.individualReadOnlyCells = new DataGridViewCellLinkedList(); this.advancedCellBorderStyle = new DataGridViewAdvancedBorderStyle(this, DataGridViewAdvancedCellBorderStyle.OutsetDouble, DataGridViewAdvancedCellBorderStyle.OutsetPartial, DataGridViewAdvancedCellBorderStyle.InsetDouble); this.advancedRowHeadersBorderStyle = new DataGridViewAdvancedBorderStyle(this); this.advancedColumnHeadersBorderStyle = new DataGridViewAdvancedBorderStyle(this); this.advancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single; this.advancedRowHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.OutsetPartial; this.advancedColumnHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.OutsetPartial; this.borderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.dataGridViewState1[0x80] = true; this.selectionMode = DataGridViewSelectionMode.RowHeaderSelect; this.editMode = DataGridViewEditMode.EditOnKeystrokeOrF2; this.autoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; this.autoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; this.columnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; this.rowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing; this.clipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithAutoHeaderText; this.layout = new LayoutData(); this.layout.TopLeftHeader = Rectangle.Empty; this.layout.ColumnHeaders = Rectangle.Empty; this.layout.RowHeaders = Rectangle.Empty; this.layout.ColumnHeadersVisible = true; this.layout.RowHeadersVisible = true; this.layout.ClientRectangle = base.ClientRectangle; this.scrollBars = System.Windows.Forms.ScrollBars.Both; this.horizScrollBar.RightToLeft = RightToLeft.Inherit; this.horizScrollBar.AccessibleName = System.Windows.Forms.SR.GetString("DataGridView_AccHorizontalScrollBarAccName"); this.horizScrollBar.Top = base.ClientRectangle.Height - this.horizScrollBar.Height; this.horizScrollBar.Left = 0; this.horizScrollBar.Visible = false; this.horizScrollBar.Scroll += new ScrollEventHandler(this.DataGridViewHScrolled); base.Controls.Add(this.horizScrollBar); this.vertScrollBar.Top = 0; this.vertScrollBar.AccessibleName = System.Windows.Forms.SR.GetString("DataGridView_AccVerticalScrollBarAccName"); this.vertScrollBar.Left = base.ClientRectangle.Width - this.vertScrollBar.Width; this.vertScrollBar.Visible = false; this.vertScrollBar.Scroll += new ScrollEventHandler(this.DataGridViewVScrolled); base.Controls.Add(this.vertScrollBar); this.ptCurrentCell = new Point(-1, -1); this.ptAnchorCell = new Point(-1, -1); this.ptMouseDownCell = new Point(-2, -2); this.ptMouseEnteredCell = new Point(-2, -2); this.ptToolTipCell = new Point(-1, -1); this.ptMouseDownGridCoord = new Point(-1, -1); this.sortOrder = System.Windows.Forms.SortOrder.None; this.lastMouseClickInfo.timeStamp = 0L; this.WireScrollBarsEvents(); base.PerformLayout(); this.toolTipControl = new DataGridViewToolTip(this); base.Invalidate(); }