我刚刚完成了这段代码,想把下面的代码改成循环。每个部门都有一个他们应该单击的特定按钮,并且应该只对部门 1、2 或 3 内的人员可见。
有人可以在这里给我一些指导吗?
pchk.Visible = true;
Int32 count = 0;
count = chk.GetCount(1);
// dept 1
if (count == -1)
{
btnDept1.Visible = false;
}
else
{
btnDept1.Text = "Next dep1[" + count.ToString() + "]";
if (count == 0)
btnDept1.Enabled = false;
}
// dept 2
count = chk.GetCount(2);
if (count == -1)
{
btnDept2.Visible = false;
}
else
{
btnDept2.Text = "Next dep2 [" + count.ToString() + "]";
if (count == 0)
btnDept02.Enabled = false;
}
// dept 3
count = chk.GetCount(3);
if (count == -1)
{
btnDept3.Visible = false;
}
else
{
btnDept3.Text = "Next dept3 [" + count.ToString() + "]";
if (count == 0)
btnDept3.Enabled = false;
}
}