以下是引用有点色在2017/1/22 18:15:00的发言:
这样写
Dim npg As WinForm.NavPage = e.Sender.parent
msgbox(npg.ButtonText)
老师,我是想在窗口加载的时候,根据权限设置,来控制NavPage是否显示; 如果NavPage内的TopicBar是显示的则设置NavPage显示,否则不显示,我现在通过很笨的方法实现了,如果可以通过TopicBar找到包含它的NavPage就简单了。
Dim nb As WinForm.NavBar = e.Form.Controls("NavBar1")
Dim tb_base As WinForm.TopicBar = e.Form.controls("tb_base")
npVisible = False
For Each tp As WinForm.TopicPage In tb_base.Pages
tpVisible=False
For Each tl As WinForm.TopicLink In tp.Links
boolVisible = Functions.Execute("CheckRight",tl.name) --返回true或False
If boolVisible = True AndAlso tpVisible=False Then
tpVisible = True
End If
tl.Visible = boolVisible
Next
If tpVisible=True AndAlso npVisible=False Then
npVisible=True
End If
tp.Visible=tpVisible
Next
For Each np As WinForm.NavPage In nb.NavPages
If np.Name="np_base" Then
np.Visible=npVisible
End If
Next