Foxtable(狐表)用户栏目专家坐堂 → 按钮样式批量设置


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

主题:按钮样式批量设置

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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/9/29 20:25:00 [显示全部帖子]

http://www.foxtable.com/webhelp/topics/1849.htm

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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/9/29 22:18:00 [显示全部帖子]

看帮助看完整,不要断章取义

For Each c As WinForm.Control In e.Form.Controls
    If
 Typeof c Is WinForm.
Button Then '判断控件是否是文本框
        
Dim t As WinForm.
Button = c '使用特定类型的变量引用控件
        t.FlatStyle = FlatStyle.flat
    End
 If
Next

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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/9/29 22:57:00 [显示全部帖子]


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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/9/30 8:33:00 [显示全部帖子]

dt.Grid.Styles("Normal").Border.Color = Color.red

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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/9/30 10:28:00 [显示全部帖子]

仔细看看:http://www.foxtable.com/webhelp/topics/1788.htm

通过控件的Table属性获得对应的Table和DataTable

Table控件本身有一个Table属性,用于返回其绑定的Table,例如:

Dim wbl As WinForm.Table = e.Form.Controls("Table1")
Dim
 tbl As Table = wbl.Table
tbl
.DataTable.Save()


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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/9/30 10:42:00 [显示全部帖子]

就是9楼的用法,然后认真看看10楼的说明。如果都看不懂,先回头学学基础:http://www.foxtable.com/webhelp/topics/1592.htm

If Typeof c Is WinForm.Table Then '判断控件是否是文本框
        Dim dt As WinForm.Table = c '使用特定类型的变量引用控件
        dt.Table.ListMode = True  '突出选定行

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


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/9/30 11:28:00 [显示全部帖子]

到底理解了什么啊!

For Each c As WinForm.Control In e.Form.Controls
    If Typeof c Is WinForm.Table Then '判断控件是否是文本框
        Dim dt As WinForm.Table = c '使用特定类型的变量引用控件
        dt.Table.ListMode = True  '突出选定行
        dt.Table.Grid.Styles("Normal").Border.Color = Color.red   '当前表格边线色
        dt.Table.DataTable.SysStyles("CurrentRow").BackColor = Color.DeepSkyBlue
        dt.Table.DataTable.SysStyles("EmptyArea").BackColor = Color.White  '当前表空白区背景色
        dt.Table.ExtendLastCol = True    '当前表自动调整列宽
        'Tables("订单").Cols("数量").Width = 150  '当前表指定列的宽度
        dt.Table.DefaultRowHeight = 40   '当前表自动固定行高
    End If
Next

如果实在看不懂,就把各种类型变量定义好再用

For Each c As WinForm.Control In e.Form.Controls
    If Typeof c Is WinForm.Table Then '判断控件是否是文本框
        Dim tbl As WinForm.Table = c '使用特定类型的变量引用控件
        Dim t As Table = tbl.Table
        Dim dt As DataTable = t.DataTable
        t.ListMode = True  '突出选定行
        t.Grid.Styles("Normal").Border.Color = Color.red   '当前表格边线色
        t.ExtendLastCol = True    '当前表自动调整列宽
        'Tables("订单").Cols("数量").Width = 150  '当前表指定列的宽度
        t.DefaultRowHeight = 40   '当前表自动固定行高
'写代码的时候尽量同类型的用法放到一起
        dt.SysStyles("CurrentRow").BackColor = Color.DeepSkyBlue
        dt.SysStyles("EmptyArea").BackColor = Color.White  '当前表空白区背景色
    End If
Next

 回到顶部