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. Image for the cookie policy date
close icon

way to detecting the click event

Hi All, I am using 3.301.0.0. Can I detect whether the image on the left side of the node''s text was clicked on? Thanks. Regards, David

4 Replies

DT Deepa TS Syncfusion Team December 16, 2005 11:09 AM UTC

Hi David, The answer for your question is Yes.You could do so by handling the TreeViewAdv''s MouseUp event as shown below : private void treeViewAdv1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { TreeNodeAdv node = this.treeViewAdv1.SelectedNode; 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); Point clickpt = new Point(e.X, e.Y); if (imgrec.Contains(clickpt)== true) { Console.WriteLine("Clicked on " + node.Text + "''s left image"); } } Please take a look at the attached sample and let me know if this meets your requirement. Thanks for your interest in Syncfusion Products. Regards, Deepa.T.S

LeftClickPoint.zip


AD Administrator Syncfusion Team December 21, 2005 06:25 AM UTC

Hi, It works fine Deepa. But gotta to know whether i will be able to detect the click point on right image in the same way as left image. Thanks. Regards, David.


DT Deepa TS Syncfusion Team December 21, 2005 07:04 AM UTC

Hi David, Thanks for the update. Again the answer for your question is Yes.You could do so by handling the same TreeViewAdv''''s MouseUp event as shown below : private void treeViewAdv1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { TreeNodeAdv node = this.treeViewAdv1.SelectedNode; Point imgpt= new Point (node.RightImagesX, node.TextBounds.Y); Size imgSize = new Size(this.imageList1.ImageSize.Width, this.imageList1.ImageSize.Height); Rectangle imgrec = new Rectangle(imgpt, imgSize); Point clickpt = new Point(e.X, e.Y); if (imgrec.Contains(clickpt)== true) { MessageBox.Show("Clicked on " + node.Text + "''s right image"); 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. Thanks for your continued interest in Syncfusion Products. Regards, Deepa.T.S

RightImageClick.zip


AD Administrator Syncfusion Team December 28, 2005 06:24 AM UTC

Hi Deepa, Thanks for your help and support. It works.. Regards, David

Loader.
Live Chat Icon For mobile
Up arrow icon