以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]固定控件在容器中  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=187168)

--  作者:江南小镇
--  发布时间:2023/6/28 9:12:00
--  [求助]固定控件在容器中
老师好,容器中平衡只能安放2个控件还有部分控件怎样放到第二行。谢谢老师。
Dim str() As String = {"第一行","上一行","下一行","最末行"}               
For i As Integer = 1 To 4
    Dim t0 As WinForm.Button = Forms("综合窗口").Controls("电" & i)
    t0.text =  str(i-1)
    t0.width = 70
    t0.height = 26
    t0.Top = 2
    t0.left = 10 + 75 * (i-1)       
    t0.Font = New Font("微软雅体", 10, FontStyle.Bold)
    t0.VisualStyle = VisualStyleEnum.office2010blue
    t0.TextAlign  = ContentAlignment.BottomCenter                                                   \'垂直靠下,水平居中
    t0.ImageAlign = ContentAlignment.TopCenter                                                      \'垂直靠上,水平居中
    t0.TextImageRelation = TextImageRelation.ImageAboveText                                         \'图标在文本的上方上方
    e.Form.Controls("SplitContainer3") .Panel2.AddControl(t0)
Next
[此贴子已经被作者于2023/6/28 9:12:23编辑过]

--  作者:有点蓝
--  发布时间:2023/6/28 10:14:00
--  
t0.Top = 2 + 31 * IIF(i<=2,0,1)   
t0.left = 10 + 75 * ((i-1) mod 2)    
--  作者:江南小镇
--  发布时间:2023/6/28 20:03:00
--  
谢谢老师