窗体动态按钮如何同时设置图标与其按钮执行的代码
Dim czy As String = User.Name
Dim cmd As New SQLCommand
cmd.CommandText = "S elect 工具栏名,可用,图标,代码 From {权限} Where 账号 = '" & czy & "'"
Dim dt As DataTable = cmd.ExecuteReader()
Dim idx As Integer = 0
For Each dr As DataRow In dt.DataRows
Dim bt As WinForm.Button
bt = e.Form.CreateControl(dr("工具栏名"), ControlTypeEnum.Button)
bt.Left = 3 + idx*80
bt.Top = 3
'bt.Image = dr("图标")
bt.Width = 80
bt.Enabled = dr("可用")
bt.Height = 45
bt.text = dr("工具栏名")
e.Form.Controls("TabControl1").Tabpages(0).AddControl(bt)
idx = idx +1
Next
[此贴子已经被作者于2020/2/25 14:41:26编辑过]