Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共11 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:[求助]如何用颜色标记一列??

1楼
zhangqinyun 发表于:2011/9/8 13:56:00

我在编写排产表

要把今天的列用颜色标记出来,怎么标记。

 

我知道标记列标题:

Tables("排产表").SetHeaderCellBackColor("D0",Color.Yellow,1)

 

但不知道怎么标记一整列,难道:

For I = 1 to Tables("排产表").Count

Tables("排产表").SetHeaderCellBackColor("D0",Color.Yellow,1)

Next

这样??

 

有没有简单的啊,我要标记好几列。

2楼
狐狸爸爸 发表于:2011/9/8 14:12:00

参考:

 

http://www.foxtable.com/help/topics/0656.htm

 

3楼
zhangqinyun 发表于:2011/9/8 14:20:00

我的排产表是临时表啊!

'排产表
Dim Td As Date = Date.Today
Dim Name As String
Dim I As Short
Dim dtb As New DataTableBuilder("排产表")
dtb.AddDef("生产组", Gettype(String), 4)
dtb.AddDef("产品编号", Gettype(String), 12)
dtb.AddDef("令号", Gettype(String), 6)
For I = -3 To 0
    dtb.AddDef("D" & I, Gettype(Integer))
    dtb.AddDef("S" & I, Gettype(Integer))
Next
For I = 1 To 14
    dtb.AddDef("D" & I, Gettype(Integer))
Next
dtb.Build()
Tables("排产表").StopRedraw
'调整列宽
With Tables("排产表")
    .Cols("生产组").Width = 40
    .Cols("产品编号").Width = 70
    .Cols("令号").Width = 45
    For I = -3 To 14
        .Cols("D" & I).Width = 40
    Next
    For I = -3 To 0
        .Cols("S" & I).Width = 40
    Next
End With
'重写列标题
Dim Cap As String
Dim ThatD As Date
For I = -3 To 14
    ThatD = Td.AddDays(I)
    If ThatD.DayOfWeek = 0 Then
        Cap = "休息"
    Else
        Cap = ThatD.Day & "日"
    End If
    DataTables("排产表").DataCols("D" & I).Caption = ThatD.Year & "年" & ThatD.Month & "月" & "_" & Cap
Next
For I = -3 To 0
    ThatD = Td.AddDays(I)
    Cap = ThatD.Day & "实"  
    DataTables("排产表").DataCols("S" & I).Caption = ThatD.Year & "年" & ThatD.Month & "月" & "_" & Cap
Next
DataTables("排产表").BuildHeader()
'颜色标记
For I = -3 To -1
    Tables("排产表").SetHeaderCellBackColor("D" & I,Color.Red,1)
Next
Tables("排产表").SetHeaderCellBackColor("D0",Color.Yellow,1)
Tables("排产表").ResumeRedraw

4楼
zhangqinyun 发表于:2011/9/8 14:21:00
上面的只有列标题标记颜色!
5楼
狐狸爸爸 发表于:2011/9/8 14:41:00
二楼有答案,您先看一下,有问题再提问吧。
6楼
zhangqinyun 发表于:2011/9/8 14:51:00

临时表没有DrawCell~ ~b

自己搞定了,,虽然代码很繁琐

'颜色标记
N = Plans.Count
For I = -3 To -1
    For I1 = 2 To N
        Tables("排产表").SetHeaderCellBackColor("D" & I,Color.Red,I1)
    Next
Next
For I = -3 To -0
    For I1 = 2 To N
        Tables("排产表").SetHeaderCellBackColor("S" & I,Color.Green,I1)
    Next
Next
For I1 = 2 To N
    Tables("排产表").SetHeaderCellBackColor("D0",Color.Yellow,I1)
Next

7楼
yangming 发表于:2011/9/8 14:57:00
setHeaderCellBackColor,这就是标题的背景色,呵
8楼
zhangqinyun 发表于:2011/9/8 15:12:00

也可以标记表里面的内容的啊.呵呵

9楼
紙上不談兵 发表于:2011/9/8 15:31:00
以下是引用zhangqinyun在2011-9-8 15:12:00的发言:

也可以标记表里面的内容的啊.呵呵

-------------------------------------------------------------------------------------

高!这都给你试出来.这样一来,就很容易有条件地标记数据了


Dim t as Table = Tables("订单")
For I As Integer = 1 To t.Rows.count
    Dim r As Row =t .Rows(i-1)
    If r("单价") > 50 Then
        t.SetHeaderCellBackColor("单价",Color.Red,I)
    End If
Next

10楼
紙上不談兵 发表于:2011/9/8 15:34:00

SetHeaderCellBackColor

设置指定列的标题的背景颜色呀。


老大,这又是意外之喜吧!
共11 条记录, 每页显示 10 条, 页签: [1] [2]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02539 s, 2 queries.