ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.ColResize Event

Occurs whenever a column is resized.

[Visual Basic]

Public Event ColResize As ColResizeEventHandler

[C#]

public event ColResizeEventHandler ColResize

[Delphi]

public property ColResize: ColResizeEventHandler read remove_ColResize write add_ColResize;

Remarks

If the ColResizeEventArgs.Cancel property is set to True, the previous column width is restored and no repainting occurs. To alter the degree of change, set the C1DisplayColumn.Width property of the C1DataColumn object specified by the ColResizeEventArgs.ColIndex property to the desired value.

It is not necessary to execute the Refresh method within this event procedure, but doing so causes the grid to be repainted even if the ColResizeEventArgs.Cancel property is True.

Example

The following code prevents columns resizing:

·      Visual Basic

       Private Sub C1TrueDBGrid1_ColResize(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.ColResizeEventArgs) Handles C1TrueDBGrid1.ColResize

           e.Cancel = True

       End Sub

·      C#

       private void c1TrueDBGrid1_ColResize(object sender, C1.Win.C1TrueDBGrid.ColResizeEventArgs e)

       {

           e.Cancel = true;

       }

·      Delphi

       procedure C1TrueDBGrid1_ColResize(sender: System.Object; e: C1.Win.C1TrueDBGrid.ColResizeEventArgs);

       begin

         e.Cancel := True;

       end;

See Also

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


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