我们假设客户计划在几分钟内完成。因此,您将在VARCHART XGantt属性页上选择分钟作为时间单位。因此,您将在VARCHART XGantt属性页上选择分钟作为时间单位。
如果您的用户现在减少或增加了应用程序中条形的长度(表示例如任务或作业或操作),则在相应的用户交互期间,此栏的持续时间将显示在InfoWindow中。

但是,709分钟给任何人的信息有多大意义果您能以天,小时和分钟显示持续时间,那么它对您的用户来说不是更相关吗重要的是:考虑到基础班次日历数据以及相应的工作和非工作间隔,显示所有这些信息不是很好吗们来看一下:

在上面的屏幕截图中,每日工作时间定义为32,400秒,即9小时。以下是使用.NET Gantt图表控件VARCHART XGantt实现此目的的方法。
第1步:选择InInteraction事件和VxTextEntrySupplying事件。
第2步:为节点(条)定义日历名称字段。
第3步:确保日历的日常工作时间以秒为单位。
第4步:使用以下代码
int _durationInMinutes = -9999; int _secondsPerWorkday = 0; private void vcGantt1_VcInteractionStarted(object sender, VcInteractionStartedEventArgs e) { //Get calendar name and initial duration of the node being modified if (e.ObjectType == VcObjectType.vcObjTypeNodeInDiagram) { VcNode node = (VcNode)e.InteractionObject; _durationInMinutes = Convert.ToInt32(node.get_DataField(6)); //6: Tasks:Duration string calName = node.get_DataField(9).ToString(); //9: Tasks:CalendarName _cal = vcGantt1.CalendarCollection.CalendarByName(calName); if (_cal == null) { //Use the default calendar _cal = vcGantt1.CalendarCollection.Active; } _secondsPerWorkday = cal.SecondsPerWorkday; if (_secondsPerWorkday == 0) { _secondsPerWorkday = 86400; //24 hours } } } private void vcGantt1_VcTextEntrySupplying(object sender, VcTextEntrySupplyingEventArgs e) { switch (e.ControlIndex) { case VcTextEntryIndex.vcTXEInfWndMinPl: case VcTextEntryIndex.vcTXEInfWndMinSi: e.Text = " Minutes"; break; case VcTextEntryIndex.vcTXEInfWndDuration: e.Text = "Current Duration"; break; case VcTextEntryIndex.vcTXEInfWndStart: e.Text = "Current Start"; break; case VcTextEntryIndex.vcTXEInfWndEnd: e.Text = "Current End"; break; case VcTextEntryIndex.vcTXEInfWndDurationValue: //Split _durationInMinutes into Days, Hours and Minutes int durationInSeconds = _durationInMinutes * 60; int days = durationInSeconds / _secondsPerWorkday; int rest = durationInSeconds % _secondsPerWorkday; int hours = rest / 3600; int minutes = (rest % 3600) / 60; e.Text = days.ToString() + " Days, " + hours.ToString() + " Hours, " + minutes.ToString(); break; } } private void vcGantt1_VcNodeModifying(object sender, VcNodeModifyingEventArgs e) { //Update current duration of the node being modified _durationInMinutes = Convert.ToInt32(e.Node.get_DataField(6)); }
标签:甘特图甘特图开发资源优化资源管理
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!