e.Form.Strips("主菜单").basecontrol.Font = new Font("黑体",18) '窗口菜单字体
For Each c As WinForm.Control In e.Form.Controls
If Typeof c Is WinForm.SplitContainer Then '分区面板
Dim t As WinForm.SplitContainer = c
t.BorderStyle = "1" 'Fixed3D
End If
If Typeof c Is WinForm.TextBox Then '文本框
Dim t As WinForm.textbox = c
t.Font = New Font("楷体",14,FontStyle.Regular)
End If
If Typeof c Is WinForm.Button Then '按纽
Dim t As WinForm.Button = c
t.Font = New Font("楷体",14,FontStyle.Regular)
End If
If Typeof c Is WinForm.RecordGrid Then
Dim t As WinForm.RecordGrid = c
t.Font = New Font("楷体",14,FontStyle.Regular)
End If
If Typeof c Is WinForm.Table Then '表
Dim t As WinForm.Table = c '使用特定类型的变量引用控件
t.Font = New Font("楷体",14,FontStyle.Regular)
' t.SetHeaderRowHeight(35) ’无效
' t.DefaultRowHeight = 35 ‘无效
t.RowHeaderVisible = False
End If
上述代码执行没有问题,但请教两个问题:
一是对于表,能否像上面一样,统一设置行高。
目前使用的是下面的方式,但是要罗列出所有表
Dim cs() As String = {"学历","家庭成员","专业技术","考核","培训"}
For Each c As String In cs
Tables(c).SetHeaderRowHeight(35) '这两项无法通过引用控件实现
Tables(c).DefaultRowHeight = 35
Next
二是代码能否简化