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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

coloring for selectednode at treeviewadv

Thread ID:

Created:

Updated:

Platform:

Replies:

72757 Apr 3,2008 08:18 AM UTC Apr 25,2008 08:22 AM UTC WinForms 3
loading
Tags: Tools
sherly
Asked On April 3, 2008 08:18 AM UTC

dear all..

how can i change color of subitem of selectednode?
i'm new on this product...
please advice....


SubhaSheela R [Syncfusion]
Replied On April 11, 2008 06:08 AM UTC

Hi Sherly,

Thank you for using Syncfusion products.

You can handle the TreeViewAdv_MouseDown event to change the color of the selected node. You can get the current mouse position by passing the X and Y axis values to the PointToNode method and change the color of that selected node by using TextColor property of TreeViewAdv. Below is the code snippet:


private void treeViewAdv1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
if (this.treeViewAdv1.PointToNode(new System.Drawing.Point(e.X, e.Y)) == null) return;
this.treeViewAdv1.PointToNode(new System.Drawing.Point(e.X, e.Y)).TextColor = Color.HotPink;
}


Please refer the sample in the below link and let me know if it helps:


http://websamples.syncfusion.com//samples/Tools.Windows/F72757/main.htm


Regards,
Subhasheela R



Sherly Numawaty
Replied On April 11, 2008 07:24 AM UTC

hi...Subhasheela
firstly thank u so much for ur reply

but the things that i want to do is, change color of subitem of selectednode, not the text of selectednode

tx u

sherly



Fathima Shalini P [Syncfusion]
Replied On April 25, 2008 08:22 AM UTC

Hi Sherly,

Thank you for your update.

Please find the code snippets given below for your reference that changes the text color of the subitems of a selected node.


private void treeViewAdv1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
if (this.treeViewAdv1.PointToNode(new System.Drawing.Point(e.X, e.Y)) == null) return;
TreeNodeAdv node = this.treeViewAdv1.PointToNode(new System.Drawing.Point(e.X, e.Y));

if (node.HasChildren)
{
foreach (TreeNodeAdv n in node.Nodes)
{
n.TextColor= Color.Blue;
}
}
}


Please find the simple sample in the following link:

http://websamples.syncfusion.com/samples/Tools.Windows/F72757_1/main.htm

Please let me know if any concerns.

Regards,
Fathima


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

;