【问题标题】:Gantt Charts甘特图
【发布时间】:2009-06-24 09:29:01
【问题描述】:

有没有人将 plexityhide 的 GTP.NET 用于 asp.net 3.5,因为我试图根据我从 linq 查询中获得的 var 为单个单元格着色,如下所示

PilotDataContext pilot = new PilotDataContext();

var schedule = from x in pilot.slot_tbl_Schedules select x;

foreach (var s in schedule)
{
    if (s.AppointmentType == "Repair")
    {
        CellLayout cl = gn.GetCell(0).Layout.Clone() as CellLayout;
        gn.GetCell(0).Layout = cll;
        cl.BackgroundColor = Color.Red;
        cl.SelectedColor = Color.Red; 
    }
    else if (s.AppointmentType == "Service")
    {
        CellLayout cl = gn.GetCell(0).Layout.Clone() as CellLayout;
        gn.GetCell(0).Layout = cl;
        cl.BackgroundColor = Color.Blue;
    }
    else if (s.AppointmentType == "TravelTime")
    {
        CellLayout cl = gn.GetCell(0).Layout.Clone() as CellLayout;
        gn.GetCell(0).Layout = cl;
        cl.BackgroundColor = Color.Green;
    }
    else if (s.AppointmentType == "AnnualLeave")
    {
        CellLayout cl = gn.GetCell(0).Layout.Clone() as CellLayout;
        gn.GetCell(0).Layout = cl;
        cl.BackgroundColor = Color.Yellow;
    }
}

if 语句中的语法是他们推荐的,任何人都可以帮助解决这个问题

非常感谢

【问题讨论】:

    标签: c# asp.net charts gantt-chart


    【解决方案1】:

    确保设置 CellLayout.BackgroundUse=true。如果您不这样做,则忽略背景颜色。

    而且由于您使用 ASP.NET,cellLayouts 会生成一个 css,因此您必须将新克隆的 CellLayouts 添加到 CellLayouts 上的集合中:

    Gantt_ASP.Gantt.Grid.CellLayouts.Add(cl);

    【讨论】:

      【解决方案2】:
      Dim cl2 As CellLayout = TryCast(e.GridNode.GetCell(4).Layout.Clone(), CellLayout)
      
      cl2.SelectedColor = Color.Red
      cl2.FontColor = Color.Red
      cl2.BackgroundColor = Color.Blue
      cl2.BackgroundUse = True ' when is true background color change 
      e.GridNode.GetCell(4).Layout = cl2
      

      它工作正常.....:)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-11-22
        • 2020-05-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-02-14
        • 2021-03-14
        相关资源
        最近更新 更多