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

TreeViewAdv images as buttons

Thread ID:

Created:

Updated:

Platform:

Replies:

57040 Feb 23,2007 11:50 PM UTC Feb 26,2007 07:28 AM UTC WinForms 1
loading
Tags: Tools
Brian Schlatter
Asked On February 23, 2007 11:50 PM UTC

Hi,

Is it possible to detect when an image from a TreeViewAdv node is clicked? Or when mouse is hovered over one?

Note: working with version 4.4.0.51

Regards,
Brian

Golda Rebecal [Syncfusion]
Replied On February 26, 2007 07:28 AM UTC

Hi Brian,

It is possible to detect when an image in a TreeViewAdv node is clicked.

This can be achieved by handling the TreeViewAdv's MouseUp event as shown below :

//To display the node's Text when the node's left image is clicked
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.leftImageList.ImageSize.Width, this.leftImageList.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 left image");
}

}

I have modified the TreeViewAdvDemo sample accordingly and have attached it here. When the left images of the countries under the Country Information node is clicked, a message box will be displayed.

Please refer to it and let me know if this works for you.

Thanks for your interest in Syncfusion products.

Best Regards,
Golda

CS51.zip

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.

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

;