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.
Unfortunately, activation email could not send to your email. Please try again.

way to detecting the click event

Thread ID:

Created:

Updated:

Platform:

Replies:

38695 Dec 16,2005 04:11 AM Dec 28,2005 01:24 AM Windows Forms 4
loading
Tags: Tools
David
Asked On December 16, 2005 04:11 AM

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

Deepa TS [Syncfusion]
Replied On December 16, 2005 06:09 AM

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

Administrator [Syncfusion]
Replied On December 21, 2005 01:25 AM

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.

Deepa TS [Syncfusion]
Replied On December 21, 2005 02:04 AM

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

Administrator [Syncfusion]
Replied On December 28, 2005 01:24 AM

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

CONFIRMATION

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.

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.

;