窗口表类型 SQLQuery
窗口打开表设置的代码
Tables(e.form.name & "_Table1").Fill ("S elect [工序],[工序承诺期],[单号],[员工姓名],数量,金额 From [今日计划明细] where 工序= '" & Vars("gxmc") & "' And DateDiff(dd,工序承诺期,getdate())>=0","zzkb",True) '从数据库取数
Tables(e.form.name & "_Table1").SetColVisibleWidth("工序|100|工序承诺期|150|单号|190|员工姓名|100|数量|100|金额|20") '列宽
Tables(e.form.name & "_Table1").Font = new font ("微软雅黑",16,fontstyle.bold) '字体大小
Tables(e.form.name & "_Table1").DefaultRowHeight = 61 '行高
Tables(e.form.name & "_Table1").ExtendLastCol = True '自动调整最后一列的宽度,以适用表宽
Tables(e.form.name & "_Table1").SetHeaderRowHeight(50) '标题行高ExtendLastCol
Tables(e.form.name & "_Table1").UseVisualStyle = False '关闭界面风格
Tables(e.form.name & "_Table1").DataTable.SysStyles("SelectedColumnHeader").backColor = Color.white '选中列标题区的背景颜色
Tables(e.form.name & "_Table1").DataTable.SysStyles("SelectedRowHeader").BackColor = Color.White '选中列标题区的背景颜色
Tables(e.form.name & "_Table1").DataTable.SysStyles("Focus").backColor = Color.white '焦点单元格的背景颜色
Tables(e.form.name & "_Table1").DataTable.SysStyles("Focus").ForeColor = Color.blue '焦点单元格的字体颜色
Tables(e.form.name & "_Table1").DataTable.SysStyles("Normal").BackColor = Color.white '数据区背景颜色
Tables(e.form.name & "_Table1").DataTable.SysStyles("Normal").foreColor = Color.blue '据区字体颜色
Tables(e.form.name & "_Table1").DataTable.SysStyles("Fixed").foreColor = Color.red '指定标题区的字体颜色
Tables(e.form.name & "_Table1").DataTable.SysStyles("EmptyArea").BackColor = Color.white '空白区背景颜色
Tables(e.form.name & "_Table1").DataTable.SysStyles("Fixed").backColor = Color.white '指定标题区的背景颜色
Tables(e.form.name & "_Table1").Cols("工序").TextAlign = HorizontalAlignment.Center '文本居中对齐
Tables(e.form.name & "_Table1").Cols("工序承诺期").TextAlign = HorizontalAlignment.Center '文本居中对齐
Tables(e.form.name & "_Table1").Cols("单号").TextAlign = HorizontalAlignment.Center '文本居中对齐
Tables(e.form.name & "_Table1").Cols("员工姓名").TextAlign = HorizontalAlignment.Center '文本居中对齐
Tables(e.form.name & "_Table1").Cols("数量").TextAlign = HorizontalAlignment.Center '文本居中对齐
Tables(e.form.name & "_Table1").Cols("金额").TextAlign = HorizontalAlignment.Center '文本居中对齐
'MessageBox.Show(8)
With DataTables(e.form.name & "_Table1")
.LoadFilter = "工序= '" & Vars("gxmc") & "' and DateDiff(dd,工序承诺期,getdate())>=0" '清除加载条件
.LoadPage = 0 '加载第一页
.LoadTop = 4 '每页7行
.LoadOver = "id"
.Load()
e.Form.Controls("TextBox4").Value = (.LoadPage + 1) & "/" & .TotalPages '显示页数状态
End With
If Tables(e.form.name & "_Table1").rows.count < 4 Then Tables(e.form.name & "_Table1").addnew(4-Tables(e.form.name & "_Table1").rows.count) '不够6行补6行
Tables(e.form.name & "_Table1").RowHeaderVisible = False '隐藏行号列
DataTables(e.form.name & "_Table1").AddUserStyle("未派工", Color.Red, Color.White)
DataTables(e.form.name & "_Table1").AddUserStyle("a", Color.Red, Color.White)
DrawCell 代码
If e.Col.Name = "员工姓名" Then
If e.Row("员工姓名") = "未派工" Then
e.Style = "a"
End If
End If

此主题相关图片如下:代码.png
