Foxtable(狐表)用户栏目专家坐堂 → [求助]更改甘特图片日期的字体


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

主题:[求助]更改甘特图片日期的字体

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


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/1/18 11:46:00 [显示全部帖子]

1、列宽的问题? 生成甘特的表的自定义函数BuildGanttTable中,加粗的一行的作用是什么:

 

Dim tbl As Table = Tables("任务")
Tables("窗口1_Table2").StopRedraw()
Dim StartDate As Date = tbl.Compute("Min(开始日期)", "开始日期 IS NOT NULL")
Dim EndDate As Date = tbl.Compute("Max(结束日期)","结束日期 IS NOT NULL")
Dim dt = StartDate
Dim Builder As New DataTableBuilder("统计")
Do
    Dim nm As String = dt.Year & "年" &  dt.Month & "月_" & dt.Day
    Builder.Adddef(nm,Gettype(String),1)
    dt = dt.Adddays(1)
    If dt > Enddate Then
        Exit Do
    End If
Loop
Tables("窗口1_Table2").DataSource = Builder.buildDataSource
For Each cl As Col In Tables("窗口1_Table2").Cols
    Dim cd As Date = cl.Name.Replace("年","-").Replace("月_","-")
    Dim d1 As Date = new Date(cd.year,5,1)
    Dim d2 As Date = new Date(cd.year,10,1)
    If cd.DayOfWeek = 0
        Tables("窗口1_Table2").SetHeaderCellForeColor(cl.name,Color.Red,1)
    ElseIf cd.DayOfWeek = 6
        Tables("窗口1_Table2").SetHeaderCellForeColor(cl.name,Color.green,1)
    ElseIf cd >=d1 AndAlso cd <= d1.AddDays(2)
        Tables("窗口1_Table2").SetHeaderCellForeColor(cl.name,Color.Yellow,1)
    ElseIf cd >=d2 AndAlso cd <= d2.AddDays(6)
        Tables("窗口1_Table2").SetHeaderCellForeColor(cl.name,Color.Yellow,1)
    End If
    cl.width = 20
Next
Functions.Execute("AddGanttRows")
Tables("窗口1_Table2").ResumeRedraw()

 

 

2、设置字体,再加一行即可:

 

Dim tbl As Table = Tables("任务")
Tables("窗口1_Table2").StopRedraw()
Dim StartDate As Date = tbl.Compute("Min(开始日期)", "开始日期 IS NOT NULL")
Dim EndDate As Date = tbl.Compute("Max(结束日期)","结束日期 IS NOT NULL")
Dim dt = StartDate
Dim Builder As New DataTableBuilder("统计")
Tables("窗口1_Table2").Font = New Font("宋体",12,FontStyle.Underline)
Do
    Dim nm As String = dt.Year & "年" &  dt.Month & "月_" & dt.Day
    Builder.Adddef(nm,Gettype(String),1)
    dt = dt.Adddays(1)
    If dt > Enddate Then
        Exit Do
    End If
Loop
Tables("窗口1_Table2").DataSource = Builder.buildDataSource
For Each cl As Col In Tables("窗口1_Table2").Cols
    Dim cd As Date = cl.Name.Replace("年","-").Replace("月_","-")
    Dim d1 As Date = new Date(cd.year,5,1)
    Dim d2 As Date = new Date(cd.year,10,1)
    If cd.DayOfWeek = 0
        Tables("窗口1_Table2").SetHeaderCellForeColor(cl.name,Color.Red,1)
    ElseIf cd.DayOfWeek = 6
        Tables("窗口1_Table2").SetHeaderCellForeColor(cl.name,Color.green,1)
    ElseIf cd >=d1 AndAlso cd <= d1.AddDays(2)
        Tables("窗口1_Table2").SetHeaderCellForeColor(cl.name,Color.Yellow,1)
    ElseIf cd >=d2 AndAlso cd <= d2.AddDays(6)
        Tables("窗口1_Table2").SetHeaderCellForeColor(cl.name,Color.Yellow,1)
    End If
    cl.width = 25
Next
Functions.Execute("AddGanttRows")
Tables("窗口1_Table2").ResumeRedraw()


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


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/1/18 16:19:00 [显示全部帖子]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:编码绘制甘特图.rar


 回到顶部