以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]窗口按钮权限  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=126422)

--  作者:hahahehe21
--  发布时间:2018/10/21 13:33:00
--  [求助]窗口按钮权限
For Each c As Winform.Control In e.Form.Controls
    If Typeof c Is WinForm.button Then
        If User.IsRole("查看") Then
            If e.sender.name = "btndyyl" Or e.sender.name = "btnzjdy" Then
                c.Enabled = True
            Else
                c.Enabled = False
            End If
        Else
            c.Enabled = True
        End If
    End If
Next

角色等于“查看”时,窗口中的按钮只有两个可用,其余不可用。
角色不等于“查看”时,窗口中的按钮全部可以用。

如何修改代码?

--  作者:有点甜
--  发布时间:2018/10/21 14:55:00
--  
For Each c As Winform.Control In e.Form.Controls
    If Typeof c Is WinForm.button Then
        If User.IsRole("查看") Then
            If c.name = "btndyyl" Or c.name = "btnzjdy" Then
                c.Enabled = True
            Else
                c.Enabled = False
            End If
        Else
            c.Enabled = True
        End If
    End If
Next