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

Sync between click event and cursor position in treeview

Hi, I have a tree control with me. My idea is that when I click a button the cursor position should be placed in the respective node i.e if I am clicking the button node1 I have to get the above behaviour on node1. Awaiting your useful suggestion. Thanks, regards, Ben

2 Replies

DT Deepa TS Syncfusion Team March 2, 2006 09:58 AM UTC

Hi Ben, Please refer to the attached sample that illustrates the above. Here the mouse cursor gets positioned appropriately when the buttons are clicked. //Provides the coordinates of the top-left corner of a TreeNodeAdv in terms of screen coordinates. private Point MousePointer(TreeNodeAdv node) { Point point = this.treeViewAdv1.PointToScreen(this.treeViewAdv1.NodeToPoint(node)); point = new Point (point.X+node.NodeX, point.Y); return point; } //coding for the cursor position on a node when a button is clicked. private void button1_Click(object sender, System.EventArgs e) { Cursor.Position = this.MousePointer (this.treeViewAdv1.Nodes[0]); } Let me know if this helps you.Thanks for your continued interest in Syncfusion Products. Kind regards, Deepa.T.S.

MousePosition.zip


AD Administrator Syncfusion Team March 17, 2006 03:04 PM UTC

Thanks for the idea!!!

Loader.
Live Chat Icon For mobile
Up arrow icon