Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Action Event, GenericPartClass Class

Occurs when a part's action is triggered by the user.

Class: GenericPartClass
Namespace: Softelvdm.Controls
Assembly: Softelvdm.SftTreeNET

Syntax

public event ActionEventHandler Action;
Public Event Action As ActionEventHandler

Comments

Occurs when a part's action is triggered by the user.

An Action event occurs when the user clicks on the part. All parts except for the gap part (GapPartClass) generate this event.

If the Action event is used, the ItemClick event does not occur.

Examples

C#

            // Add a text part to the first cell (could use CellBaseClass.Text instead)
            CellClass cell = item.Cells[0];
            TextPartClass tp = new TextPartClass("The first cell", LineStyleEnum.Wordwrap, HAlignmentOptionalEnum.Left,
                         VAlignmentOptionalEnum.Top, Color.Blue, Color.Green, Color.Red, Color.Blue, new Font("Arial", 12), StringFormatFlags.LineLimit| StringFormatFlags.MeasureTrailingSpaces); 
            cell.Parts.Add(tp);
            // Followed by a check box (still in the first cell)
            CheckBoxPartClass cb = new CheckBoxPartClass( CheckBoxStateEnum.Unchecked, HAlignmentOptionalEnum.Left, VAlignmentOptionalEnum.Top, true);
            cb.Action += new GenericPartClass.ActionEventHandler(cb_Action);
            cell.Parts.Add(cb);
            // Followed by an image (still in the first cell)
            ImagePartClass ip = new ImagePartClass(img);
            cell.Parts.Add(ip);
            
            // Add contents to the second cell
            item.Cells[1].Text = "The\neasy\nway";

VB.NET

    ' Add a text part to the first cell (could use CellBaseClass.Text instead)
    Dim cell As CellClass = item.Cells(0)
    Dim tp As TextPartClass = New TextPartClass("The first cell", LineStyleEnum.Wordwrap, HAlignmentOptionalEnum.Left, _
             VAlignmentOptionalEnum.Top, Color.Blue, Color.Green, Color.Red, Color.Blue, New Font("Arial", 12), StringFormatFlags.LineLimit Or StringFormatFlags.MeasureTrailingSpaces)
    cell.Parts.Add(tp)
    ' Followed by a check box (still in the first cell)
    Dim cb As CheckBoxPartClass = New CheckBoxPartClass(CheckBoxStateEnum.Unchecked, HAlignmentOptionalEnum.Left, VAlignmentOptionalEnum.Top, True)
    AddHandler cb.Action, AddressOf cb_Action
    cell.Parts.Add(cb)
    ' Followed by an image (still in the first cell)
    Dim ip As ImagePartClass = New ImagePartClass(img)
    cell.Parts.Add(ip)

    ' Add contents to the second cell
    item.Cells(1).Text = "The" & vbCrLf & "easy" & vbCrLf & "way"

See Also GenericPartClass Class | Classes | SftTree/NET 2.0



Spring Break!

Our offices will be closed this week (March 18 through March 22).

We'll be back March 24 to address any pending sales and support issues.