ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.SplitChange Event

Occurs whenever a Split changes focus.

[Visual Basic]

Public Event SplitChange As EventHandler

[C#]

public event EventHandler SplitChange

[Delphi]

public property SplitChange: EventHandler read remove_SplitChange write add_SplitChange;

Remarks

This event is triggered under several circumstances:

·      When the grid is first displayed.

·      When the user clicks a cell in another split, subject to the setting of the C1DisplayColumn.AllowFocus property.

·      When the user presses a navigation key to cross a split boundary, subject to the setting of the TabAcrossSplits property.

·      When the SplitIndex property is changed in code to a different value.

·      When a new split is inserted before the current split via code or user interaction.

·      When the current split is removed via code or user interaction.

If the user edits data and then moves the current cell position to a new row in another split, the update events for the original row are completed before the SplitChange event is executed.

If a split change also results in a change to the current row or column, then the SplitChange event will always precede the RowColChange event.

Example

The following code changes the backcolor to Azure when the user crosses a split:

·      Visual Basic

       Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

           Me.C1TrueDBGrid1.InsertHorizontalSplit(1)

           Me.C1TrueDBGrid1.TabAcrossSplits = True

           Me.C1TrueDBGrid1.TabAction = C1.Win.C1TrueDBGrid.TabActionEnum.ColumnNavigation

           Me.C1TrueDBGrid1.SplitIndex = 0

       End Sub

       Private Sub C1TrueDBGrid1_SplitChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1TrueDBGrid1.SplitChange

           Me.C1TrueDBGrid1.Splits(Me.C1TrueDBGrid1.SplitIndex).Style.BackColor = Color.Azure

       End Sub

·      C#

       private void Form1_Load(object sender, System.EventArgs e)

       {

           this.c1TrueDBGrid1.InsertHorizontalSplit(1);

           this.c1TrueDBGrid1.TabAcrossSplits = true;

           this.c1TrueDBGrid1.TabAction = TabActionEnum.ColumnNavigation;

           this.c1TrueDBGrid1.SplitIndex = 0;

       }

       private void c1TrueDBGrid1_SplitChange(object sender, EventArgs e)

       {

           this.c1TrueDBGrid1.Splits(this.c1TrueDBGrid1.SplitIndex).Style.BackColor = Color.Azure;

       }

·      Delphi

       procedure Form1_Load(sender: System.Object; e: System.EventArgs);

       begin

         Self.C1TrueDBGrid1.InsertHorizontalSplit(1);

         Self.C1TrueDBGrid1.TabAcrossSplits := True;

         Self.C1TrueDBGrid1.TabAction := TabActionEnum.ColumnNavigation;

         Self.C1TrueDBGrid1.SplitIndex := 0;

       end;

       procedure C1TrueDBGrid1_SplitChange(sender: System.Object; e: EventArgs);

       begin

         Self.C1TrueDBGrid1.Splits(Self.C1TrueDBGrid1.SplitIndex).Style.BackColor := Color.Azure;

       end;

See Also

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


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