GrapeCity.Win.MultiRow Namespace > GcMultiRow Class > GetIntersectedHeaderCells Method : GetIntersectedHeaderCells(Int32,Int32,Orientation,MultiRowSelectionMode) Method |
<TakeCellFreezeAttribute(True)> Public Overloads Function GetIntersectedHeaderCells( _ ByVal rowIndex As Integer, _ ByVal cellIndex As Integer, _ ByVal direction As Orientation, _ ByVal mode As MultiRowSelectionMode _ ) As HeaderCell()
Dim instance As GcMultiRow Dim rowIndex As Integer Dim cellIndex As Integer Dim direction As Orientation Dim mode As MultiRowSelectionMode Dim value() As HeaderCell value = instance.GetIntersectedHeaderCells(rowIndex, cellIndex, direction, mode)
[TakeCellFreeze(true)] public HeaderCell[] GetIntersectedHeaderCells( int rowIndex, int cellIndex, Orientation direction, MultiRowSelectionMode mode )
Exception | Description |
---|---|
System.ArgumentOutOfRangeException | The rowIndex is less than 0 or greater than RowCount minus 1. -or- The cellIndex is less than 0 or greater than the number of Cells in the Row minus 1. |
System.ComponentModel.InvalidEnumArgumentException | The direction is not one of the System.Windows.Forms.Orientation values. -or- The mode parameter is not one of the MultiRowSelectionMode values. |
System.ArgumentException | The mode is not MultiRowSelectionMode.ContainedCells and MultiRowSelectionMode.IntersectedCells. |
void gcMultiRow1_CellPainting(object sender, CellPaintingEventArgs e) { if (!this.gcMultiRow1.CurrentCellPosition.IsEmpty) { //Retrieve all HeaderCells from ColumnHeaderSection. HeaderCell[] verticalHeaderCells = this.gcMultiRow1.GetIntersectedHeaderCells(this.gcMultiRow1.CurrentCellPosition.RowIndex, this.gcMultiRow1.CurrentCellPosition.CellIndex, Orientation.Vertical, MultiRowSelectionMode.ContainedCells); foreach (HeaderCell item in verticalHeaderCells) { if (e.SectionIndex == item.RowIndex && e.CellIndex == item.CellIndex && e.Scope == CellScope.ColumnHeader) { using (LinearGradientBrush brush = new LinearGradientBrush(e.CellBounds, Color.Pink, Color.Orange, LinearGradientMode.Vertical)) { e.Graphics.FillRectangle(brush, e.CellBounds); } e.PaintForeground(e.ClipBounds); e.CellStyle.Border = new Border(LineStyle.Thin, Color.Orange); e.PaintBorder(e.ClipBounds); e.Handled = true; } } //Retrieve all HeaderCells from Row section. HeaderCell[] horizontalHeaderCells = this.gcMultiRow1.GetIntersectedHeaderCells(this.gcMultiRow1.CurrentCellPosition.RowIndex, this.gcMultiRow1.CurrentCellPosition.CellIndex, Orientation.Horizontal, MultiRowSelectionMode.ContainedCells); foreach (HeaderCell item in horizontalHeaderCells) { if (e.SectionIndex == item.RowIndex && e.CellIndex == item.CellIndex && e.Scope == CellScope.Row) { using (LinearGradientBrush brush = new LinearGradientBrush(e.CellBounds, Color.Pink, Color.Orange, LinearGradientMode.Vertical)) { e.Graphics.FillRectangle(brush, e.CellBounds); } e.PaintForeground(e.ClipBounds); e.CellStyle.Border = new Border(LineStyle.Thin, Color.Orange); e.PaintBorder(e.ClipBounds); e.Handled = true; } } } }
Private Sub gcMultiRow1_CellPainting(ByVal sender As Object, ByVal e As CellPaintingEventArgs) Handles gcMultiRow1.CellPainting If Not Me.gcMultiRow1.CurrentCellPosition.IsEmpty Then 'Retrieve all HeaderCells from ColumnHeaderSection. Dim verticalHeaderCells As HeaderCell() = Me.gcMultiRow1.GetIntersectedHeaderCells(Me.gcMultiRow1.CurrentCellPosition.RowIndex, Me.gcMultiRow1.CurrentCellPosition.CellIndex, Orientation.Vertical, MultiRowSelectionMode.ContainedCells) For Each item As HeaderCell In verticalHeaderCells If e.SectionIndex = item.RowIndex AndAlso e.CellIndex = item.CellIndex AndAlso e.Scope = CellScope.ColumnHeader Then Using brush As New LinearGradientBrush(e.CellBounds, Color.Pink, Color.Orange, LinearGradientMode.Vertical) e.Graphics.FillRectangle(brush, e.CellBounds) End Using e.PaintForeground(e.ClipBounds) e.CellStyle.Border = New Border(LineStyle.Thin, Color.Orange) e.PaintBorder(e.ClipBounds) e.Handled = True End If Next 'Retrieve all HeaderCells from Row section. Dim horizontalHeaderCells As HeaderCell() = Me.gcMultiRow1.GetIntersectedHeaderCells(Me.gcMultiRow1.CurrentCellPosition.RowIndex, Me.gcMultiRow1.CurrentCellPosition.CellIndex, Orientation.Horizontal, MultiRowSelectionMode.ContainedCells) For Each item As HeaderCell In horizontalHeaderCells If e.SectionIndex = item.RowIndex AndAlso e.CellIndex = item.CellIndex AndAlso e.Scope = CellScope.Row Then Using brush As New LinearGradientBrush(e.CellBounds, Color.Pink, Color.Orange, LinearGradientMode.Vertical) e.Graphics.FillRectangle(brush, e.CellBounds) End Using e.PaintForeground(e.ClipBounds) e.CellStyle.Border = New Border(LineStyle.Thin, Color.Orange) e.PaintBorder(e.ClipBounds) e.Handled = True End If Next End If End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2