以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 按钮样式批量设置 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141469) |
-- 作者:yifan3429 -- 发布时间:2019/9/29 19:27:00 -- 按钮样式批量设置 With e.Form.Controls("Button1") .FlatStyle = FlatStyle.flat .BackColor = Color.DeepSkyBlue \'设置按钮的背景颜色 .BorderSize = 0 .MouseOverBackColor = Color.Cyan End With 想要 窗口内所有的 Button 批量设置样式 Dim dt As Table = Tables("工作计划") \'Tables(e.form.tableName).ListMode = True \'突出选定行 \'Tables(e.form.tableName).ExtendLastCol = True \'当前表自动调整列宽 dt.ListMode = True \'突出选定行 dt.DataTable.SysStyles("CurrentRow").BackColor = Color.DeepSkyBlue dt.DataTable.SysStyles("EmptyArea").BackColor = Color.White \'当前表空白区背景色 dt.ExtendLastCol = True \'当前表自动调整列宽 \'Tables("订单").Cols("数量").Width = 150 \'当前表指定列的宽度 dt.DefaultRowHeight = 40 \'当前表自动固定行高 想要 窗口内所有的 Table 批量设置样式 [此贴子已经被作者于2019/9/29 19:29:06编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/9/29 20:25:00 -- http://www.foxtable.com/webhelp/topics/1849.htm |
-- 作者:yifan3429 -- 发布时间:2019/9/29 21:40:00 -- Dim b As WinForm.Control b = e.Form.Controls("TextBox1") 还是到了具体的编号 我想要所有的这个控件都一样 b.BackColor = Color.Red 和下面这个没有区别啊 With e.Form.Controls("Button1") .FlatStyle = FlatStyle.flat .BackColor = Color.DeepSkyBlue \'设置按钮的背景颜色 .BorderSize = 0 .MouseOverBackColor = Color.Cyan End With 不会用For Each Dim v As Button For Each t As Table In Button t.FlatStyle = FlatStyle.flat t .BackColor = Color.DeepSkyBlue \'设置按钮的背景颜色 t .BorderSize = 0 t.MouseOverBackColor = Color.Cyan Next [此贴子已经被作者于2019/9/29 22:07:13编辑过]
|
-- 作者:有点蓝 -- 发布时间: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 |
-- 作者:yifan3429 -- 发布时间:2019/9/29 22:33: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.ListMode = True \'突出选定行 dt.DataTable.SysStyles("CurrentRow").BackColor = Color.DeepSkyBlue dt.DataTable.SysStyles("EmptyArea").BackColor = Color.White \'当前表空白区背景色 dt.ExtendLastCol = True \'当前表自动调整列宽 dt.DefaultRowHeight = 40 \'当前表自动固定行高 End If Next 窗体所有表设置这个怎么改呢
[此贴子已经被作者于2019/9/29 22:33:46编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/9/29 22:57:00 -- 仔细看看:http://www.foxtable.com/webhelp/topics/1788.htm |
-- 作者:yifan3429 -- 发布时间:2019/9/29 23:00:00 -- Dim dt As Table = Tables("工作计划") dt.ListMode = True \'突出选定行 dt.DataTable.SysStyles("CurrentRow").BackColor = Color.DeepSkyBlue dt.DataTable.SysStyles("EmptyArea").BackColor = Color.White \'当前表空白区背景色 \'dt.DataTable.SysStyles("Normal").BackColor = Color.red dt.ExtendLastCol = True \'当前表自动调整列宽 dt.DefaultRowHeight = 40 \'当前表自动固定行高 单表这样是可以达到效果的,就是不能设置网格线, 现表多了想批量设置 老师麻烦您教下我怎么写
[此贴子已经被作者于2019/9/29 23:07:46编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/9/30 8:33:00 -- dt.Grid.Styles("Normal").Border.Color = Color.red |
-- 作者:yifan3429 -- 发布时间:2019/9/30 10:22:00 -- 还需要老师指导 --------------------------- 错误 --------------------------- 编译错误:“DataTable”不是“WinForm.Table”的成员。 错误代码:dt.DataTable.SysStyles("CurrentRow").BackColor = Color.DeepSkyBlue --------------------------- 确定 --------------------------- For Each c As WinForm.Control In e.Form.Controls If Typeof c Is WinForm.Table Then \'判断控件是否是文本框 Dim dt As WinForm.Table = c \'使用特定类型的变量引用控件 dt.ListMode = True \'突出选定行 dt.Grid.Styles("Normal").Border.Color = Color.red \'当前表格边线色 dt.DataTable.SysStyles("CurrentRow").BackColor = Color.DeepSkyBlue dt.DataTable.SysStyles("EmptyArea").BackColor = Color.White \'当前表空白区背景色 \'dt.DataTable.SysStyles("Normal").BackColor = Color.red dt.ExtendLastCol = True \'当前表自动调整列宽 \'Tables("订单").Cols("数量").Width = 150 \'当前表指定列的宽度 dt.DefaultRowHeight = 40 \'当前表自动固定行高 End If Next [此贴子已经被作者于2019/9/30 10:28:32编辑过]
|
-- 作者:有点蓝 -- 发布时间: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") |