Foxtable(狐表)用户栏目专家坐堂 → 统一设置窗体中控件的有关属性


  共有1709人关注过本帖树形打印复制链接

主题:统一设置窗体中控件的有关属性

帅哥哟,离线,有人找我吗?
lake163
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:276 积分:2971 威望:0 精华:0 注册:2010/9/20 11:21:00
统一设置窗体中控件的有关属性  发帖心情 Post By: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

二是代码能否简化



 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/2/2 17:58:00 [只看该作者]

t.Table.SetHeaderRowHeight(35)    ’无效
t.Table.DefaultRowHeight = 35           ‘无效

 回到顶部
帅哥哟,离线,有人找我吗?
lake163
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:276 积分:2971 威望:0 精华:0 注册:2010/9/20 11:21:00
  发帖心情 Post By:2018/2/2 18:07:00 [只看该作者]

谢谢!

 回到顶部