Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

ActionEventHandler Delegate, GenericPartClass Class

Represents the method that will handle the Action event of a part.

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

Syntax

public delegate void ActionEventHandler(
    object sender,
    ActionEventArgs e );
Public Delegate Sub ActionEventHandler(
    ByVal sender As Object,
    ByVal e As ActionEventArgs )

Parameters

sender

The source of the event.

e

An EventArgs instance that contains the event data.

Comments

Represents the method that will handle the Action event of a part.

An ActionEventHandler delegate is created by an application to identify the method that will handle the Action event.

To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about handling events with delegates, see Handling and Raising Events (.NET Documentation).

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";

See Also GenericPartClass Class | Classes | SftTree/NET 2.0