GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : SectionPainting Event |
<SRDescriptionAttribute("Occurs when a section needs to be drawn.")> <SRCategoryAttribute("Display")> Public Event SectionPainting As EventHandler(Of SectionPaintingEventArgs)
Dim instance As GcMultiRow Dim handler As EventHandler(Of SectionPaintingEventArgs) AddHandler instance.SectionPainting, handler
[SRDescription("Occurs when a section needs to be drawn.")] [SRCategory("Display")] public event EventHandler<SectionPaintingEventArgs> SectionPainting
The event handler receives an argument of type SectionPaintingEventArgs containing data related to this event. The following SectionPaintingEventArgs properties provide information specific to this event.
Property | Description |
---|---|
ClipBounds | Gets the clip area of the current Section that is being painted. |
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. |
SectionBounds | Gets the boundary of this section. |
SectionIndex | Gets the index of the owner Section that the event occurs for. |
ZoomFactor | Gets the zoom factor of the current GcMultiRow control. |
You can handle this event to customize the appearance of sections in the control. You can paint entire sections yourself, or paint specific parts of sections and use the SectionPaintingEventArgs.PaintSectionBackground, SectionPaintingEventArgs.PaintCells, or SectionPaintingEventArgs.PaintSectionBorder method to paint other parts.
When handling this event, you should access the section through the event handler parameters, rather than accessing the section directly.
The paint result can output a PrintStyle.Rich style print, but cannot output a PrintStyle.Compact style print.
void gcMultiRow_SectionPainting(object sender, SectionPaintingEventArgs e) { if (e.RowIndex == this.gcMultiRow.NewRowIndex && e.Scope == CellScope.Row) { e.Paint(e.ClipBounds); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; // Paint string in section face. e.Graphics.DrawString("Edit cell in this row to add new rows", gcMultiRow.Font, Brushes.Gray, e.SectionBounds, sf); // If you customize the paint logic, make sure the Handled property is set to true. e.Handled = true; } }
Private Sub gcMultiRow_SectionPainting(ByVal sender As Object, ByVal e As SectionPaintingEventArgs) Handles gcMultiRow.SectionPainting If e.RowIndex = Me.gcMultiRow.NewRowIndex AndAlso e.Scope = CellScope.Row Then e.Paint(e.ClipBounds) Dim sf As New StringFormat() sf.Alignment = StringAlignment.Center ' Paint string in section face. e.Graphics.DrawString("Edit cell in this row to add new rows", gcMultiRow.Font, Brushes.Gray, e.SectionBounds, sf) ' 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