i made a treeview and want to check or uncheck the node if mouse is clicked over it.
my code looks like this :
but if i click on the same height as the node, not on the text, the node would be checked or unchecked too... this would be inconvenient for the users, because the width of the treeview is big, so if the user click on the empty space on the right or left side of the tree, the node on the same height is going to be checked or unchecked..
how can i make so this would only happen if i click on the text?
thx in advance
ps: i'm using C# if it makes any differences
my code looks like this :
Code:
private void treeViewBildObjekt_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
TreeNodeExt selectedNode = (TreeNodeExt) treeViewBildObjekt.GetNodeAt(
treeViewBildObjekt.PointToClient(Cursor.Position));
if ((selectedNode != null) && (e.Button == MouseButtons.Left))
{
selectedNode.Checked = !selectedNode.Checked;
}
}
but if i click on the same height as the node, not on the text, the node would be checked or unchecked too... this would be inconvenient for the users, because the width of the treeview is big, so if the user click on the empty space on the right or left side of the tree, the node on the same height is going to be checked or unchecked..
how can i make so this would only happen if i click on the text?
thx in advance
ps: i'm using C# if it makes any differences