winform中我定义了一个treeview,并且在treeview前面加上了复选框。我如何判断复选框是否被选中?急。
如题:1我在RoleTree_AfterSelect点击时间中如何能判断,节点前的复选框是否被勾上(选中状态)?2并且如果点击选中后能级联他的父级节点前的复选框也选中?请...
如题:1我在RoleTree_AfterSelect点击时间中如何能判断,节点前的复选框是否被勾上(选中状态)?2并且如果点击选中后能级联他的父级节点前的复选框也选中?请分条回答。谢谢,答案好有加分,谢谢各位了,急!!!
展开
1个回答
展开全部
1.
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
bool isChecked = e.Node.Checked;
}
2.
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
TreeNode tn = e.Node;
if (tn.Checked)
{
TreeNode parent = tn.Parent;
while (parent != null) { parent.Checked = true; parent = parent.Parent; }
}
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
bool isChecked = e.Node.Checked;
}
2.
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
TreeNode tn = e.Node;
if (tn.Checked)
{
TreeNode parent = tn.Parent;
while (parent != null) { parent.Checked = true; parent = parent.Parent; }
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询