ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.OwnerDrawCell Event

Occurs before a cell is rendered and the C1DisplayColumn.OwnerDraw is true.

[Visual Basic]

Public Event OwnerDrawCell As OwnerDrawCellEventHandler

[C#]

public event OwnerDrawCellEventHandler OwnerDrawCell

[Delphi]

public property OwnerDrawCell: OwnerDrawCellEventHandler read remove_OwnerDrawCell write add_OwnerDrawCell;

Remarks

This event is only raised for columns in which the C1DisplayColumn.OwnerDraw property is set to True.

Example

The following code raises OwnerDrawCell event to display the text of the content in the cells that start with a '-' as green text:

·      Visual Basic

       Private Sub C1TrueDBGrid1_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.OwnerDrawCellEventArgs)

               If e.Text.StartsWith("-") Then

               e.Style.ForeColor = Color.Red

           End If

       End Sub

·      C#

       private void C1TrueDBGrid1_OwnerDrawCell(object sender, C1.Win.C1TrueDBGrid.OwnerDrawCellEventArgs e)

       {

           if(e.Text.StartsWith("-"))

           {

               e.Style.ForeColor= Color.Red;

           }

       }

·      Delphi

       procedure C1TrueDBGrid1_OwnerDrawCell(sender: System.Object; e: C1.Win.C1TrueDBGrid.OwnerDrawCellEventArgs);

       begin

         if e.Text.StartsWith('-') then

           e.Style.ForeColor := Color.Red;

       end;

See Also

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


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