Click or drag to resize
CellControlOnDraw Method
Raises the DrawCellControl event.

Namespace: Stingray.Grid
Assembly: Stingray.GridControl (in Stingray.GridControl.dll) Version: 14.0.0.0
Syntax
protected virtual void OnDraw(
	DrawCellControlEventArgs e
)

Parameters

e
Type: Stingray.GridDrawCellControlEventArgs
The event data.
Remarks
This method is invoked each time this CellControl is drawn. How the cell control is drawn depends mostly upon whether or not the cell is the current cell, which is shown by the event arguments. At this time, this event indicates when cells are drawn and allows the end user to implement custom drawing logic for inactive cell controls.

Note: Stingray Grid .NET maintains only one instance of a custom .NET control for all cells in which that control is used. Therefore, the control can be drawn in only one cell at a time. This may make it difficult for the end user to find out what kind of control is used in a cell when it is not the current, active cell. This event allows you to use GDI+ to draw inactive cells using a bitmap or other mechanism to indicate the type of control used in the cell.

Presently, this event is not intended to facilitate custom drawing of the current active cell.

The following steps show the default event handling for this event:

  • If the property is true, the grid draws the cell.
  • The DrawCellControl event is raised, and delegates are invoked with event arguments supplying a GDI+ Graphics object, cell style information, and a property indicating whether or not the cell to be drawn is the current cell.
  • If the cell is the current cell, the control is drawn. If the UseCellStyle property is set, the font, background color, and text color for the control are set using the cell style for the current cell. The location and size of the control are changed to fit in the bounds of the current cell. The control Visible property is set to true, and the control is refreshed.

See Also