I am doing an win form application. I am using a tree view and my tree view is like
Root
|-> Child
|->a.txt
|->Child1
|-> a.txt
and so on
Now if i had my mouse over any sub child of that containing the text file i would like to show the path of that file saved on a tool tip.
I used the following code but it does not work properly when i move my mouse on to the other nodes that tool tip is still getting displayed any solution for this
My code
private void treeViewACH_NodeMouseHover(object sender, TreeNodeMouseHoverEventArgs e)
{
if (treeViewACH.SelectedNode.Text == "ACHFile")
{
ttpShow.RemoveAll();
}
if (treeViewACH.SelectedNode.Parent != null)
{
string strSwitch = treeViewACH.SelectedNode.Parent.Text;
switch (strSwitch)
{
case "FileHeader":
{
Node = treeViewACH.SelectedNode.Text;
strFilePath = Directory.GetCurrentDirectory();
strFilePath = Directory.GetParent(strFilePath).ToString();
strFilePath = Directory.GetParent(strFilePath).ToString();
strFilePath = strFilePath + "\\ACH\\" + Node;
if (File.Exists(strFilePath))
{
ttpShow.SetToolTip(treeViewACH, strFilePath);
}
break;
}
}
}
}
Got the answer for this just modified the above code