We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

button or clickable pic in the node of TreeView

Thread ID:





35201 Sep 26,2005 01:51 PM UTC Sep 27,2005 09:53 AM UTC WinForms 2
Tags: Tools
Asked On September 26, 2005 01:51 PM UTC

How can we associate a button or other control or something like clickable icon with the node of tree? We need to show our "open dialog" which will add the nodes to the tree, when user will click such button. The click on the node will select the node, the doubleclick will expand the node, so we need some clickable area associated with the node.

Administrator [Syncfusion]
Replied On September 26, 2005 04:39 PM UTC

I can say in addition, that we also need buttons near some nodes to save the nodes content. So the implicit ways of user interaction with the node, like doubleclick on the node, will not be siutable for the user. The clickable right and left icons of the node seems the best way, but how can we catch an event of icon click?

Vijayanand S [Syncfusion]
Replied On September 27, 2005 09:53 AM UTC

Hi Eugene, You could use the Left Image and Right Image of a node as a clickable area to use it as a button associated with that particular tree node. Following is the code snippet that illustrates this: private void treeViewAdv1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { Point clickpt = new Point(e.X, e.Y); TreeNodeAdv node = this.treeViewAdv1.PointToNode( clickpt ); string aText; aText = node.Text; //To check whether mouse clicking on the left image. Point imgpt = new Point (node.TextAndImageBounds.X, node.TextAndImageBounds.Y); Size imgSize = new Size(this.imageList1.ImageSize.Width, this.imageList1.ImageSize.Height); Rectangle imgrec = new Rectangle(imgpt, imgSize); if (imgrec.Contains(clickpt)== true) { Console.WriteLine("Clicked on " + node.Text + "''''s left image"); } //To check whether the mouse clicking on the RightImage point. Point imgpt1 = new Point (node.RightImagesX,node.TextBounds.Y); Size imgSize1 = new Size(this.imageList2.ImageSize.Width, this.imageList2.ImageSize.Height); Rectangle imgrec1 = new Rectangle(imgpt1, imgSize1); if (imgrec1.Contains(clickpt)== true) { Console.WriteLine("Clicked on " + node.Text + "''''s right image"); } } Please take a look at the attached sample and let me know if this meets your requirement. If not, please provide more details regarding this issue and modify the attached sample and send it over to me. Thanks for using Syncfusion products. Regards, Vijay TreeViewAdv


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon