public DataGrid() { base.SetStyle(ControlStyles.UserPaint, true); base.SetStyle(ControlStyles.Opaque, false); base.SetStyle(ControlStyles.SupportsTransparentBackColor, false); base.SetStyle(ControlStyles.UserMouse, true); this.gridState = new BitVector32(0x42827); this.dataGridTables = new GridTableStylesCollection(this); this.layout = this.CreateInitialLayoutState(); this.parentRows = new DataGridParentRows(this); this.horizScrollBar.Top = base.ClientRectangle.Height - this.horizScrollBar.Height; this.horizScrollBar.Left = 0; this.horizScrollBar.Visible = false; this.horizScrollBar.Scroll += new ScrollEventHandler(this.GridHScrolled); base.Controls.Add(this.horizScrollBar); this.vertScrollBar.Top = 0; this.vertScrollBar.Left = base.ClientRectangle.Width - this.vertScrollBar.Width; this.vertScrollBar.Visible = false; this.vertScrollBar.Scroll += new ScrollEventHandler(this.GridVScrolled); base.Controls.Add(this.vertScrollBar); this.BackColor = DefaultBackBrush.Color; this.ForeColor = DefaultForeBrush.Color; this.borderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.currentChangedHandler = new EventHandler(this.DataSource_RowChanged); this.positionChangedHandler = new EventHandler(this.DataSource_PositionChanged); this.itemChangedHandler = new ItemChangedEventHandler(this.DataSource_ItemChanged); this.metaDataChangedHandler = new EventHandler(this.DataSource_MetaDataChanged); this.dataGridTableStylesCollectionChanged = new CollectionChangeEventHandler(this.TableStylesCollectionChanged); this.dataGridTables.CollectionChanged += this.dataGridTableStylesCollectionChanged; this.SetDataGridTable(this.defaultTableStyle, true); this.backButtonHandler = new EventHandler(this.OnBackButtonClicked); this.downButtonHandler = new EventHandler(this.OnShowParentDetailsButtonClicked); this.caption = new DataGridCaption(this); this.caption.BackwardClicked += this.backButtonHandler; this.caption.DownClicked += this.downButtonHandler; this.RecalculateFonts(); base.Size = new Size(130, 80); base.Invalidate(); base.PerformLayout(); }
internal EventEntry(DataGridCaption.EventEntry next, object key, Delegate handler) { this.next = next; this.key = key; this.handler = handler; }
private void ComputeLayout() { bool flag = !this.isRightToLeft(); Rectangle resizeBoxRect = this.layout.ResizeBoxRect; this.EndEdit(); this.ClearRegionCache(); LayoutData data = new LayoutData(this.layout) { Inside = base.ClientRectangle }; Rectangle inside = data.Inside; int borderWidth = this.BorderWidth; inside.Inflate(-borderWidth, -borderWidth); Rectangle rectangle3 = inside; if (this.layout.CaptionVisible) { int num2 = this.captionFontHeight + 6; Rectangle caption = data.Caption; caption = rectangle3; caption.Height = num2; rectangle3.Y += num2; rectangle3.Height -= num2; data.Caption = caption; } else { data.Caption = Rectangle.Empty; } if (this.layout.ParentRowsVisible) { Rectangle parentRows = data.ParentRows; int height = this.parentRows.Height; parentRows = rectangle3; parentRows.Height = height; rectangle3.Y += height; rectangle3.Height -= height; data.ParentRows = parentRows; } else { data.ParentRows = Rectangle.Empty; } int num4 = this.headerFontHeight + 6; if (this.layout.ColumnHeadersVisible) { Rectangle columnHeaders = data.ColumnHeaders; columnHeaders = rectangle3; columnHeaders.Height = num4; rectangle3.Y += num4; rectangle3.Height -= num4; data.ColumnHeaders = columnHeaders; } else { data.ColumnHeaders = Rectangle.Empty; } bool flag2 = this.myGridTable.IsDefault ? this.RowHeadersVisible : this.myGridTable.RowHeadersVisible; int num5 = this.myGridTable.IsDefault ? this.RowHeaderWidth : this.myGridTable.RowHeaderWidth; data.RowHeadersVisible = flag2; if ((this.myGridTable != null) && flag2) { Rectangle rowHeaders = data.RowHeaders; if (flag) { rowHeaders = rectangle3; rowHeaders.Width = num5; rectangle3.X += num5; rectangle3.Width -= num5; } else { rowHeaders = rectangle3; rowHeaders.Width = num5; rowHeaders.X = rectangle3.Right - num5; rectangle3.Width -= num5; } data.RowHeaders = rowHeaders; if (this.layout.ColumnHeadersVisible) { Rectangle topLeftHeader = data.TopLeftHeader; Rectangle rectangle9 = data.ColumnHeaders; if (flag) { topLeftHeader = rectangle9; topLeftHeader.Width = num5; rectangle9.Width -= num5; rectangle9.X += num5; } else { topLeftHeader = rectangle9; topLeftHeader.Width = num5; topLeftHeader.X = rectangle9.Right - num5; rectangle9.Width -= num5; } data.TopLeftHeader = topLeftHeader; data.ColumnHeaders = rectangle9; } else { data.TopLeftHeader = Rectangle.Empty; } } else { data.RowHeaders = Rectangle.Empty; data.TopLeftHeader = Rectangle.Empty; } data.Data = rectangle3; data.Inside = inside; this.layout = data; this.LayoutScrollBars(); if (!resizeBoxRect.Equals(this.layout.ResizeBoxRect) && !this.layout.ResizeBoxRect.IsEmpty) { base.Invalidate(this.layout.ResizeBoxRect); } this.layout.dirty = false; }