ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.OwnerDrawPageHeader Event

Occurs before the page header is to be printed.

[Visual Basic]

Public Event OwnerDrawPageHeader As OwnerDrawPageEventHandler

[C#]

public event OwnerDrawPageEventHandler OwnerDrawPageHeader

[Delphi]

public property OwnerDrawPageHeader: OwnerDrawPageEventHandler read remove_OwnerDrawPageHeader write add_OwnerDrawPageHeader;

Remarks

This event is only raised for PrintInfo objects in which the PrintInfo.OwnerDrawPageHeader property is set to True.

The only property for this event is the OwnerDrawPageEventArgs.OwnerDrawPrint property. This event and OwnerDrawPageFooter event both use an object called the C1OwnerDrawPrint object to render the appropriate text and images. The OwnerDrawPageEventArgs.OwnerDrawPrint property provides access to this object that has one property and three methods to aid in rendering the correct images. For more information see the OwnerDrawPageEventArgs reference.

Example

The following code adds a custom header to the grid when previewing and printing:

·      Visual Basic

       Private Sub C1TrueDBGrid1_OwnerDrawPageHeader(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.OwnerDrawPageEventArgs) Handles C1TrueDBGrid1.OwnerDrawPageHeader

           Dim fnt As System.Drawing.Font = New System.Drawing.Font(Font, FontStyle.Bold)

           e.OwnerDrawPrint.RenderDirectText(0, 0, "Composers Grid", 300, fnt, Color.DarkSlateGray, C1.Win.C1TrueDBGrid.AlignHorzEnum.Near)

       End Sub

·      C#

       private void C1TrueDBGrid1_OwnerDrawPageHeader(object sender, C1.Win.C1TrueDBGrid.OwnerDrawPageEventArgs e)

       {

           System.Drawing.Font fnt = new System.Drawing.Font(Font, FontStyle.Bold);

           e.OwnerDrawPrint.RenderDirectText(0, 0, "Composers Grid", 300, fnt, Color.DarkSlateGray, C1.Win.C1TrueDBGrid.AlignHorzEnum.Near);

       }

·      Delphi

       procedure C1TrueDBGrid1_OwnerDrawPageHeader(sender: System.Object; e: C1.Win.C1TrueDBGrid.OwnerDrawPageEventArgs);

       var

         fnt: System.Drawing.Font;

       begin

         fnt := System.Drawing.Font.Create(Font, FontStyle.Bold);

         e.OwnerDrawPrint.RenderDirectText(0, 0, 'Composers Grid', 300, fnt, Color.DarkSlateGray, C1.Win.C1TrueDBGrid.AlignHorzEnum.Near);

       end;

See Also

C1TrueDBGrid Class | C1TrueDBGrid Members | C1.Win.C1TrueDBGrid Namespace


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.