以文本方式查看主题

-  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=114311)

--  作者:lake163
--  发布时间:2018/2/2 17:55:00
--  统一设置窗体中控件的有关属性
窗口中有各类控件,想分类设置相关属性,如下:
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
Next

上述代码执行没有问题,但请教两个问题:
一是对于表,能否像上面一样,统一设置行高。
目前使用的是下面的方式,但是要罗列出所有表 
Dim cs() As String = {"学历","家庭成员","专业技术","考核","培训"}
For Each c As String In cs
    Tables(c).SetHeaderRowHeight(35)    \'这两项无法通过引用控件实现
    Tables(c).DefaultRowHeight = 35
Next

二是代码能否简化



--  作者:有点甜
--  发布时间:2018/2/2 17:58:00
--  
t.Table.SetHeaderRowHeight(35)    ’无效
t.Table.DefaultRowHeight = 35           ‘无效

--  作者:lake163
--  发布时间:2018/2/2 18:07:00
--  
谢谢!