FlexPivot for WinForms
OwnerDrawCell イベント (C1FlexGridBase)

C1.Win.C1FlexGrid.4.5.2 アセンブリ > C1.Win.C1FlexGrid 名前空間 > C1FlexGridBase クラス : OwnerDrawCell イベント
Fires before the grid draws a cell, when the DrawMode property is set to DrawModeEnum.OwnerDraw.
シンタックス
'宣言
 
Public Event OwnerDrawCell As OwnerDrawCellEventHandler
public event OwnerDrawCellEventHandler OwnerDrawCell
イベント データ

イベント ハンドラが、このイベントに関連するデータを含む、OwnerDrawCellEventArgs 型の引数を受け取りました。次の OwnerDrawCellEventArgs プロパティには、このイベントの固有の情報が記載されます。

プロパティ解説
Get the rectangle where the cell will be painted (in client coordinates).  
Get the column index of the cell being painted.  
Gets the Graphics object used to draw the cell. Use this object to draw custom elements in the cell.  
Gets or sets whether the event has finished drawing the cell.  
Gets or sets the image that will be displayed in the cell.  
Gets a value that determines if the event was fired only to measure the cell.  
Get the row index of the cell being painted.  
Sets or sets the CellStyle object used to paint the cell.  
Gets or sets the text that will be displayed in the cell.  
解説

The OwnerDrawCell event only fires when the DrawMode property is set to DrawModeEnum.OwnerDraw.

You can use this event to customize the appearance of any cell in the grid. The event allows three main types of customization:

  1. Change the value of the Text and Image parameters to modify the values displayed by the grid. You can use this type of customization to replace password strings with asterisks, for example.
  2. Change the Style property to display the cell using a different style than the one selected by the grid by default. You can use this type of customization to provide conditional formatting, for example.
  3. Use the Graphics and Bounds parameters and draw the cell yourself. When drawing cells this way, you may call the OwnerDrawCellEventArgs.DrawCell member to force the grid to draw specific parts of the cell, while your code draws other parts. For example, you could paint a custom background and then call DrawCell to have the grid paint the cell border and contents.

The OwnerDrawCell event also fires when the grid auto sizes rows or columns (see the AutoSizeRows(Int32,Int32,Int32,Int32,Int32,AutoSizeFlags) and AutoSizeCols(Int32,Int32,Int32,Int32,Int32,AutoSizeFlags) methods). This is done because the grid needs to measure the cell using the same text, image, and style parameters that are used to render it. In these cases, the Measuring parameter is set to true and the Bounds rectangle is empty.

参照