翻譯|使用教程|編輯:莫成敏|2020-01-06 10:50:19.933|閱讀 465 次
概述:本文總結(jié)了VARCHART XGantt的常見(jiàn)問(wèn)題:如何提高性能?主要是關(guān)于.NET版本的問(wèn)題,感興趣的朋友快來(lái)了解一下吧~
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
相關(guān)鏈接:
VARCHART XGantt是一個(gè)交互式的甘特圖控件,其模塊化的設(shè)計(jì)讓您可以創(chuàng)建滿(mǎn)足您和您的客戶(hù)所需求的應(yīng)用程序。(我們領(lǐng)先的甘特圖控件VARCHART XGantt可用于.NET,ActiveX和ASP.NET應(yīng)用程序。)使用交互式甘特圖提供令人驚嘆的視覺(jué)調(diào)度體驗(yàn),增強(qiáng)您的計(jì)劃用戶(hù)體驗(yàn)。
本文介紹了VARCHART XGantt常見(jiàn)問(wèn)題中的如何提高性能問(wèn)題,并且針對(duì)該問(wèn)題作出回答,現(xiàn)在就來(lái)了解一下吧~
如果對(duì)每個(gè)節(jié)點(diǎn)重復(fù)執(zhí)行更新操作,則包含大量節(jié)點(diǎn)的項(xiàng)目可能會(huì)花費(fèi)太長(zhǎng)時(shí)間。并非每個(gè)自動(dòng)更新過(guò)程都是必需的;在這種情況下,您可以暫停單個(gè)更新,處理一系列代碼,然后進(jìn)行最終更新。暫停和重新激活更新都可以通過(guò)SuspendUpdate方法完成,該方法在代碼序列的開(kāi)頭設(shè)置為True,在代碼序列的結(jié)尾設(shè)置為False。使用此方法可以顯著提高整體性能。
示例代碼VB.NET
Dim dataTable As VcDataTable Dim dataRecordCltn As VcDataRecordCollection Dim dataRecord As VcDataRecord dataTable = VcGantt1.DataTableCollection.DataTableByName("Maindata") dataRecordCltn = dataTable.DataRecordCollection VcGantt1.SuspendUpdate(True) For Each dataRecord In dataRecordCltn dataRecord.DataField(4) = "10" dataRecord.Update() Next VcGantt1.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);
您還可以通過(guò)SuspendUpdate方法加快鏈接的更新過(guò)程。
如果在大型項(xiàng)目中修改表格式,則還應(yīng)該使用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); }
當(dāng)您使用不等距的直方圖曲線時(shí),此方法還可以加快更新過(guò)程。
示例代碼VB.NET
Dim histogram As VcHistogram Dim curve As VcCurve Dim index As Integer Dim aDate As Date histogram = VcGantt1.HistogramCollection.FirstHistogram curve = histogram.CurveCollection.CurveByName("Curve1") ' current date aDate = Date.Today() VcGantt1.SuspendUpdate(True) For index = 1 To 3000 ' shifting by 2 hrs aDate = aDate.AddHours(2) curve.SetValues(aDate, index) Next VcGantt1.SuspendUpdate(False)
示例代碼C#
// current date DateTime 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);當(dāng)您使用日歷時(shí),該方法還可以加快更新過(guò)程,因為在加載節(jié)點(diǎn)后,對(duì)日歷的修改需要大量時(shí)間,因?yàn)閺哪菚r(shí)起,對(duì)于所有節(jié)點(diǎn),程序都必須檢查它們是否依賴(lài)于日歷。
圖形
性能低下的另一個(gè)原因可能是表、節(jié)點(diǎn)或框字段中的圖形太大或像素太多。
本文是關(guān)于.NET版本中的提高性能,關(guān)于ActiveX版本中提高性能的問(wèn)題,后續(xù)將會(huì)更新,敬請(qǐng)期待哦~您還可以下載VARCHART XGantt試用版進(jìn)行免費(fèi)體驗(yàn)~
相關(guān)內(nèi)容推薦:
VARCHART XGantt用戶(hù)手冊(cè)>>>
交互式甘特圖VARCHART XGantt常見(jiàn)問(wèn)題:Borland Delphi用戶(hù)升級(jí)新版本時(shí)怎么做?
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: