Profile Picture

Click on Treelist Subitems

Posted By Dieter Spiegel 14 Years Ago
Author
Message
Dieter Spiegel
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 9, Visits: 1
Is there an easy way in the treelist to get the subitem that the user clicked on? I can get the selected item, but have problems retrieving the subitem.

Thanks

Dieter


Angel Chorbadzhiev
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)

Group: Forum Members
Last Active: Last Month
Posts: 139, Visits: 184

Hello Dieter,

You can get the subitem of NTreeList when the user click on it by the following way:

//Attach to MouseUp event

nTreeList1.MouseUp += new MouseEventHandler(nTreeList1_MouseUp);

...

void nTreeList1_MouseUp(object sender, MouseEventArgs e)

{

    NTreeListNode node = (NTreeListNode)nTreeList1.ItemFromPoint(new NPoint(e.Location));

    for (int i = 0; i < node.SubItems.Count; i++)

    {

        Rectangle r = node.SubItems[i].ViewBounds.ToRectangle();

        if (r.Contains(e.Location))

        {

            subItem = node.SubItems[i];

            return;

        }

    }

}

 

Regards,

Angel.





Similar Topics


Reading This Topic