GrapeCity MultiRow Windows Forms Documentation
SectionPaintingEventArgs Class
Members  Example 


Provides data for the GcMultiRow.SectionPainting event of the GcMultiRow control.
Syntax
Public Class SectionPaintingEventArgs 
   Inherits System.ComponentModel.HandledEventArgs
Dim instance As SectionPaintingEventArgs
public class SectionPaintingEventArgs : System.ComponentModel.HandledEventArgs 
Remarks

The GcMultiRow.SectionPainting event is raised for each Section that is visible on a GcMultiRow control. If you manually paint the section, set the System.ComponentModel.HandledEventArgs.Handled property to true. If you do not set System.ComponentModel.HandledEventArgs.Handled to true, the section will paint over your customizations.

In GcMultiRow's painting logic, a section's paint work can be divided in three areas. They are section backgrounds, cells, and section borders.

There are three methods: PaintSectionBackground, PaintCells, and PaintSectionBorder. Each one corresponds to a paint area of a section. If you do not want to manually paint all parts of a section, call these methods to help paint. The default order to paint a section is section background->cells->section border.

Example
The following code example shows how to customize a sections paint logic. This code example is part of a larger example provided for the GcMultiRow.CellPainting event.
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
Inheritance Hierarchy

System.Object
   System.EventArgs
      System.ComponentModel.HandledEventArgs
         GrapeCity.Win.MultiRow.SectionPaintingEventArgs

Requirements

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

See Also

Reference

SectionPaintingEventArgs Members
GrapeCity.Win.MultiRow Namespace
SectionPainting Event

 

 


Copyright © GrapeCity, inc. All rights reserved.