老师,动态生成的控件,设置了图标和控件名的位置及相对位置,为什么相对位置不对呢
此主题相关图片如下:qq截图20210823102433.jpg

For Each aj2 As DataRow In ajm
Dim aj As String = aj2("名称")
Dim jpg As String = aj2("图标")
Dim hsmc As String = "a" & aj2("分组") & aj & aj2("序号")
If hsdms.ContainsKey(hsmc)=False Then
hsdms.add(hsmc,aj2("代码"))
End If
Dim abc As WinForm.Button
abc=frm.CreateControl(hsmc,ControlTypeEnum.button)
abc.Text=aj
abc.Dock= 1 '锚定
abc.Height= 25 '页面高度
abc.Image=GetImage(jpg) '图标
abc.TextAlign = ContentAlignment.MiddleLeft '文本位置
abc.ImageAlign = ContentAlignment.MiddleLeft '图标位置
abc.TextImageRelation = TextImageRelationEnum.ImageBeforeText 'Automatic图标相对位置,图标在文本之前
abc.VisualStyle= IVisualStyle.Office2010Blue '主题
frm.AddControl(abc)
o.Pages(za).controls.add(Forms("左导航").Controls(hsmc).basecontrol)
Next
Next
[此贴子已经被作者于2021/8/23 10:38:22编辑过]