FlexPivot for WinForms
GetMergedRange(Int32,Int32,Boolean) メソッド
使用例 

C1.Win.C1FlexGrid.4.5.2 アセンブリ > C1.Win.C1FlexGrid 名前空間 > C1FlexGrid クラス > GetMergedRange メソッド : GetMergedRange(Int32,Int32,Boolean) メソッド
Row index.
Column index.
Whether the range should be clipped to the visible area of the grid.
Returns the merged range of cells that includes a given cell.
シンタックス
'宣言
 
Public Overloads Overridable Function GetMergedRange( _
   ByVal row As System.Integer, _
   ByVal col As System.Integer, _
   ByVal clip As System.Boolean _
) As CellRange
public virtual CellRange GetMergedRange( 
   System.int row,
   System.int col,
   System.bool clip
)

パラメータ

row
Row index.
col
Column index.
clip
Whether the range should be clipped to the visible area of the grid.

戻り値の型

A CellRange object that contains the given cell.
解説

Cell merging is controlled by the AllowMerging property. The GetMergedRange(Int32,Int32,Boolean) method allows you to determine whether a cell is merged with adjacent cells.

You can override the GetMergedRange(Int32,Int32,Boolean) method to implement custom merging logic. If you do this, make sure the merging method is consistent and efficient, since it gets called frequently and affects the grid's appearance and behavior.

使用例
The code below checks the current cell after a selection to see if it is part of a merged range: The code below shows how you can override the GetMergedRange(Int32,Int32,Boolean) method to provide custom merging:
private void _flex_SelChange(object sender, System.EventArgs e)
{
  CellRange rg = this._flex.GetMergedRange(_flex.Row, _flex.Col, false);
  if (!rg.IsSingleCell)
  {
    Console.WriteLine("selection is merged: {0},{1}-{2},{3}",
    rg.TopRow, rg.LeftCol, rg.BottomRow, rg.RightCol);
  }
}
public class CustomMerge : C1FlexGrid
{
  public CustomMerge()
  {
    // allow free merging by default
    AllowMerging = AllowMergingEnum.Free;
    for (int r = 0; r < Rows.Count; r++) Rows[r].AllowMerging = true;
    for (int c = 0; c < Cols.Count; c++) Cols[c].AllowMerging = true;
  }
  override public CellRange GetMergedRange(int row, int col, bool clip)
  {
    // merge cells in range (1,1)-(3,3)
    if (row >= 1 && row <= 3 && col >= 1 && col <= 3)
      return GetCellRange(1, 1, 3, 3);
      
    // don't merge anything else
    return GetCellRange(row, col);
  }
}
参照

C1FlexGrid クラス
C1FlexGrid メンバ
オーバーロード一覧