For Each dr As DataRow In DataTables("权限设置").Select("用户名 = '" & _username & "' And 窗口名 = '" & e.form.Name & "'") Dim c = e.form.Controls(dr("按钮权限")) If typeof c Is winform.Table Then c.visible = Not dr("不可见") c.Table.allowEdit = Not dr("不可编辑") Else c.Visible = Not dr("不可见") c.Enabled = Not dr("不可编辑") End If Next