TreeViewAdv images as buttons

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

1 Reply

GR Golda Rebecal Syncfusion Team 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

Loader.
Up arrow icon