交互式甘特图VARCHART XGantt常见问题:如何提高性能?(.NET版)

本文总结了VARCHART XGantt的常见问题:如何提高性能?主要是关于.NET版本的问题,感兴趣的朋友快来了解一下吧~

VARCHART XGantt是一个交互式的甘特图控件,其模块化的设计让您可以创建满足您和您的客户所需求的应用程序。(我们领先的甘特图控件VARCHART XGantt可用于.NET,ActiveX和ASP.NET应用程序。)使用交互式甘特图提供令人惊叹的视觉调度体验,增强您的计划用户体验。

本文介绍了VARCHART XGantt常见问题中的如何提高性能问题,并且针对该问题作出回答,现在就来了解一下吧~

VARCHART XGantt正式版


暂停更新

如果对每个节点重复执行更新操作,则包含大量节点的项目可能会花费太长时间。并非每个自动更新过程都是必需的;在这种情况下,您可以暂停单个更新,处理一系列代码,然后进行最终更新。暂停和重新激活更新都可以通过SuspendUpdate方法完成,该方法在代码序列的开头设置为True,在代码序列的结尾设置为False。使用此方法可以显着提高整体性能。

示例代码VB.NET

Dim dataTable As VcDataTableDim dataRecordCltn As VcDataRecordCollectionDim dataRecord As VcDataRecorddataTable = VcGantt1.DataTableCollection.DataTableByName("Maindata")dataRecordCltn = dataTable.DataRecordCollectionVcGantt1.SuspendUpdate(True)For Each dataRecord In dataRecordCltn dataRecord.DataField(4) = "10" dataRecord.Update()NextVcGantt1.SuspendUpdate(False) 

示例代码C#

VcDataTable dataTable =vcGantt1.DataTableCollection.DataTableByName("Maindata");VcDataRecordCollection dataRecordCltn = dataTable.DataRecordCollection;vcGantt1.SuspendUpdate(true);foreach (VcDataRecord dataRecord in dataRecordCltn){ dataRecord.set_DataField(4, "10"); dataRecord.Update();}vcGantt1.SuspendUpdate(false); 

您还可以通过SuspendUpdate方法加快链接的更新过程。

如果在大型项目中修改表格式,则还应该使用SuspendUpdate方法。

示例代码VB.NET

Private Sub ModifyTable_Click() Dim formatCltn As VcTableFormatCollection Dim aFormat As VcTableFormat Dim index As Integer VcGantt1.SuspendUpdate(True) formatCltn = VcGantt1.LeftTable.TableFormatCollection For Each aFormat In formatCltn For index = 1 To aFormat.FormatFieldCount aFormat.FormatField(index).BackgroundColor = Color.Green aFormat.FormatField(index).TextFontColor = Color.Red aFormat.FormatField(index).Alignment =VcFormatFieldAlignment.vcFFACenter Next Next VcGantt1.SuspendUpdate(False)End Sub 

示例代码C#

private void ModifyTable_Click() { VcTableFormatCollection formatCltn =vcGantt1.LeftTable.TableFormatCollection; vcGantt1.SuspendUpdate(true); foreach (VcTableFormat aFormat in formatCltn) { for (int index=1; index <= aFormat.FormatFieldCount; index++) { aFormat.get_FormatField(index).BackgroundColor = Color.Green; aFormat.get_FormatField(index).TextFontColor = Color.Red; aFormat.get_FormatField(index).Alignment = VcFormatFieldAlignment.vcFFACenter; } } vcGantt1.SuspendUpdate(false); } 

当您使用不等距的直方图曲线时,此方法还可以加快更新过程。

示例代码VB.NET

Dim histogram As VcHistogramDim curve As VcCurveDim index As IntegerDim aDate As Datehistogram = VcGantt1.HistogramCollection.FirstHistogramcurve = histogram.CurveCollection.CurveByName("Curve1")' current dateaDate = Date.Today()VcGantt1.SuspendUpdate(True)For index = 1 To 3000 ' shifting by 2 hrs aDate = aDate.AddHours(2) curve.SetValues(aDate, index)NextVcGantt1.SuspendUpdate(False) 

示例代码C#

// current dateDateTime aDate = DateTime.Today;vcGantt1.SuspendUpdate(true);for (int index=1; index < 3000; index++) { // shifting by 2 hrs aDate = aDate.AddHours(2); curve.SetValues(aDate, Convert.ToString(index)); } vcGantt1.SuspendUpdate(false); 

当您使用日历时,该方法还可以加快更新过程,因为在加载节点后,对日历的修改需要大量时间,因为从那时起,对于所有节点,程序都必须检查它们是否依赖于日历。

图形

性能低下的另一个原因可能是表、节点或框字段中的图形太大或像素太多。

本文是关于.NET版本中的提高性能,关于ActiveX版本中提高性能的问题,后续将会更新,敬请期待哦~您还可以下载VARCHART XGantt试用版进行免费体验~

相关内容推荐:

VARCHART XGantt用户手册>>>

交互式甘特图VARCHART XGantt常见问题:Borland Delphi用户升级新版本时怎么做/span>


想要购买VARCHART XGantt正版授权,或了解更多产品信息请点击【咨询在线客服

交互式甘特图VARCHART XGantt常见问题:如何提高性能?(.NET版)

标签:

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年1月3日
下一篇 2020年1月3日

相关推荐

发表回复

登录后才能评论