以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 动态控件分组 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=190802) |
||||
-- 作者:yifan3429 -- 发布时间:2024/3/5 11:08:00 -- 动态控件分组 Dim zcdd As WinForm.Button If dr("窗口按键_菜单") < > Nothing Then
Dim Value1 As String = dr("窗口按键_按键")
Dim Value2 As String = dr("窗口按键_数据视图")
Dim Value3 As String = dr("窗口按键_导出报表")
Dim Value As String = dr("窗口按键_菜单")
Dim sps() As Char = {"|"}
Dim Names() As String = Value.Split(sps)
Dim s As Integer = 2
Dim t As Integer = 5
For i As Integer = 0 To Names.length - 1
If i <> 0 Then
If i Mod 3 = 0 Then
s = 2
t = t + 41.9
Else
s = s + 72.9
End If
End If
Dim nm As String = Names(i)
zcdd = Forms("主窗_菜单").CreateControl(nm, ControlTypeEnum.Button)
zcdd.Theme = "(none)" \'去掉原来的样式 zcdd.Font = New Font("宋体", 9, FontStyle.Regular) zcdd.Text = nm zcdd.name = nm zcdd.Width = 72 zcdd.Height = 41 zcdd.Left = s + 8 zcdd.Top = t + 2 zcdd.BorderSize = 0 希望达成如下效果
lvw.Groups.Add("按键") \'添加分组 lvw.Groups.Add("视图") \'添加分组 lvw.Groups.Add("报表") \'添加分组 For Each nm As String In Value1 Dim vr As WinForm.ListViewRow = lvw.Rows.Add() vr.Text = nm \'设置行标题 vr.Group = "按键" \'设置行的分组 Next For Each nm As String In Value2 Dim vr As WinForm.ListViewRow = lvw.Rows.Add() vr.Text = nm \'设置行标题 vr.Group = "视图" \'设置行的分组 Next
For Each nm As String In Value3 Dim vr As WinForm.ListViewRow = lvw.Rows.Add() vr.Text = nm \'设置行标题 vr.Group = "报表" \'设置行的分组 Next Forms("主窗_菜单").Controls("菜单页面").Tabpages("功能操作").AddControl(zcdd)
zcdd.ToolTip = zcdd.Text \'动态提示
Next
End If [此贴子已经被作者于2024/3/5 11:29:58编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2024/3/5 11:24:00 -- 请上传实例,并截图说明要什么效果 |
||||
-- 作者:yifan3429 -- 发布时间:2024/3/5 14:19:00 --
控件分组 此主题相关图片如下:企业微信截图_20240305141753.png |
||||
-- 作者:有点蓝 -- 发布时间:2024/3/5 15:05:00 --
|
||||
-- 作者:yifan3429 -- 发布时间:2024/3/5 16:03:00 -- GroupBox 高度可以根据控件内容变化吗
|
||||
-- 作者:有点蓝 -- 发布时间:2024/3/5 16:22:00 -- 根据添加完按钮后t2的值设置GroupBox的高度 |