老师好,我在两个分区面板里各集合了9个按钮但只能显示一个分区面板的按钮。
Dim str() As String = {"第一行","上一行","下一行","最末行","增加行","删除行","保存","修改","锁定"} ' ,"材料计算","数据查询"}
For i As Integer = 1 To 9
Dim t2 As WinForm.Button = Forms("系统").Controls("电" & i)
t2.text = str(i-1)
t2.width = 70
t2.height = 26
t2.Top = 415
t2.left = 30 + 75 * (i-1)
t2.Font = New Font("微软雅体", 10, FontStyle.Bold)
t2.VisualStyle = VisualStyleEnum.office2010blue
t2.TextAlign = ContentAlignment.BottomCenter '垂直靠下,水平居中
t2.ImageAlign = ContentAlignment.TopCenter '垂直靠上,水平居中
t2.TextImageRelation = TextImageRelation.ImageAboveText '图标在文本的上方上方
e.Form.Controls("SplitContainer2") .Panel2.AddControl(t2)
Next
Dim str1() As String = {"第一行","上一行","下一行","最末行","增加行","删除行","保存","修改","锁定"} ' ,"材料计算","数据查询"}
'Dim picname8() As String = {"1018","1019","1020","1021","1022"}
For i As Integer = 1 To 9
Dim t1 As WinForm.Button = Forms("系统").Controls("水" & i)
't2.Image = GetImage(ProjectPath & "Attachments\图片\" & picname8(i-1)& ".jpg")
t1.text = str1(i-1)
t1.width = 70
t1.height = 26
t1.Top = 420
t1.left = 30 + 75 * (i-1) '30左边距 90是90-80是按钮和按钮之间的间距
t1.Font = New Font("微软雅体", 10, FontStyle.Bold)
t1.VisualStyle = VisualStyleEnum.office2010blue
t1.TextAlign = ContentAlignment.BottomCenter '垂直靠下,水平居中
t1.ImageAlign = ContentAlignment.TopCenter '垂直靠上,水平居中
t1.TextImageRelation = TextImageRelation.ImageAboveText '图标在文本的上方上方
'''t2.BackColor =Color.DeepPink
't2.Anchor = Windows.Forms.AnchorStyles.Top Or Windows.Forms.AnchorStyles.Bottom '锚定 '设置背景颜色
'''e.Form.Controls("系统面板3").AddControl(t2)
e.Form.Controls("SplitContainer3") .Panel2.AddControl(t1)
Next
[此贴子已经被作者于2023/6/19 15:20:23编辑过]