GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : CellPainting Event |
<SRDescriptionAttribute("Occurs when a cell needs to be drawn.")> <SRCategoryAttribute("Display")> Public Event CellPainting As EventHandler(Of CellPaintingEventArgs)
Dim instance As GcMultiRow Dim handler As EventHandler(Of CellPaintingEventArgs) AddHandler instance.CellPainting, handler
[SRDescription("Occurs when a cell needs to be drawn.")] [SRCategory("Display")] public event EventHandler<CellPaintingEventArgs> CellPainting
The event handler receives an argument of type CellPaintingEventArgs containing data related to this event. The following CellPaintingEventArgs properties provide information specific to this event.
Property | Description |
---|---|
CellBounds | Gets the cell boundary. |
CellIndex | Gets the cell index in its parent Section. |
CellName | Gets the name of the cell. |
CellStyle | Gets the display style of the Cell being painted. |
ClipBounds | Gets the clip boundary of the current Cell that is being painted. |
Enabled | Gets a value that indicates whether this cell is enabled. |
ErrorIcon | Gets the cell error icon. |
ErrorIconAlignment | Gets the alignment of the error icon associated with the cell. |
ErrorText | Gets the error text of the error that occurred on the cell. |
FormattedValue | Gets the formatted value of the current cell. |
Graphics | Gets the graphics object used to draw the cell. |
Handled | (Inherited from System.ComponentModel.HandledEventArgs) |
IsPrinting | Gets a value that indicates whether this cell is being printed. |
RowIndex | Gets the index of the owner Row that the event occurs for. |
Scope | Gets the cell area that the event occurs for. |
SectionIndex | Gets the index of the owner Section that the event occurs for. |
Selected | Gets a value that indicates whether the specified Cell is selected. |
Value | Gets the cell value. |
ZoomFactor | Gets the zoom factor of the current GcMultiRow control. |
You can handle this event to customize the cell appearance in the control. You can paint entire cells yourself, or paint specific parts of cells and use the CellPaintingEventArgs.PaintBackground, CellPaintingEventArgs.PaintForeground, CellPaintingEventArgs.PaintErrorIcon, or CellPaintingEventArgs.PaintBorder method to paint other parts.
When handling this event, you should access the cell with the event handler parameters, rather than accessing the cell directly.
The paint result can output a PrintStyle.Rich style print, but cannot output a PrintStyle.Compact style print.
void gcMultiRow_CellPainting(object sender, CellPaintingEventArgs e) { if (e.CellIndex == 1 && e.Scope == CellScope.Row) { e.PaintBackground(e.ClipBounds); PaintRateBlock(e); e.PaintForeground(e.ClipBounds); e.PaintBorder(e.ClipBounds); // If you customize the paint logic, make sure the Handled property is set to true. e.Handled = true; } }
Private Sub gcMultiRow_CellPainting(ByVal sender As Object, ByVal e As CellPaintingEventArgs) Handles gcMultiRow.CellPainting If e.CellIndex = 1 AndAlso e.Scope = CellScope.Row Then e.PaintBackground(e.ClipBounds) PaintRateBlock(e) e.PaintForeground(e.ClipBounds) e.PaintBorder(e.ClipBounds) ' If you customize the paint logic, make sure the Handled property is set to true. e.Handled = True 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