翻譯|行業(yè)資訊|編輯:龔雪|2023-08-09 10:48:34.100|閱讀 119 次
概述:本文將為大家介紹界面控件DevExpress WinForms的Gantt組件,在v23.1中附帶了一個(gè)新的時(shí)間軸UI元素。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
DevExpress WinForms的Gantt組件在v23.1中附帶了一個(gè)新的時(shí)間軸UI元素,Gantt(甘特圖)控件本身允許您計(jì)劃/管理項(xiàng)目,而時(shí)間軸顯示單個(gè)任務(wù)的開始和截止日期,并提供項(xiàng)目進(jìn)度的鳥瞰圖。
DevExpress WinForms 擁有180+組件和UI庫(kù),能為Windows Forms平臺(tái)創(chuàng)建具有影響力的業(yè)務(wù)解決方案。DevExpress WinForms能完美構(gòu)建流暢、美觀且易于使用的應(yīng)用程序,無(wú)論是Office風(fēng)格的界面,還是分析處理大批量的業(yè)務(wù)數(shù)據(jù),它都能輕松勝任!
DevExpress技術(shù)交流群8:523159565 歡迎一起進(jìn)群討論
時(shí)間軸可以顯示多個(gè)帶有任務(wù)/里程碑、今日指示器和日期范圍選擇器的時(shí)間軸條。
時(shí)間軸的上下文菜單允許用戶添加/刪除時(shí)間軸條,從時(shí)間軸中刪除任務(wù)/里程碑,或快速導(dǎo)航到甘特圖樹和圖表中的任務(wù)。
Gantt(甘特圖)控件可以在頂部或底部顯示時(shí)間軸。
using DevExpress.XtraGantt; // Displays a timeline at the top of the Gantt control. ganttControl1.OptionsTimeline.TimelinePosition = TimelinePosition.Top;
最終用戶的選項(xiàng)包括:
使用GanttControl.OptionsTimeline屬性來(lái)訪問(wèn)和自定義時(shí)間軸設(shè)置:
您可以根據(jù)特定條件修改單個(gè)任務(wù)的標(biāo)題/詳細(xì)信息/描述,要應(yīng)用修改,請(qǐng)?zhí)幚鞢ustomTimelineItemText事件,甘特圖控件為時(shí)間軸中顯示的每個(gè)任務(wù)觸發(fā)此事件。
我們還實(shí)現(xiàn)了Custom Draw APIs(自定義繪制API),方便您可以根據(jù)需要繪制時(shí)間軸條和任務(wù),這些API包括:
使用以下屬性將數(shù)據(jù)源中的字段映射到任務(wù)屬性:
public Form1() { InitializeComponent(); // Bind the Gantt control to a data source. ganttControl1.DataSource = TaskData.InitData(); // Configures the Gantt control's mappings. ganttControl1.TreeListMappings.KeyFieldName = "Id"; ganttControl1.TreeListMappings.ParentFieldName = "ParentId"; ganttControl1.ChartMappings.StartDateFieldName = "StartDate"; ganttControl1.ChartMappings.FinishDateFieldName = "EndDate"; ganttControl1.ChartMappings.TimelineCaption = "TimelineCaption"; // Maps the Gantt control to a field in a data source with Boolean values that // specify which tasks to display on the timeline when the application starts. ganttControl1.ChartMappings.VisibleInTimelineFieldName = "ShowInTimeline"; } public class TaskData { public TaskData(int id) { this.id = id; } int id; public int Id { get { return id; } } public string TimelineCaption { get { return string.Format("Timeline Caption: {0}", Name); } } public bool ShowInTimeline { get; set; } = false; public int ParentId { get; set; } public string Name { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public static List<TaskData> InitData() { return new List<TaskData>() { new TaskData(0){ Name = "Task A", ParentId = 0, StartDate = new DateTime(2023, 3, 1), EndDate = new DateTime(2024, 3, 31) }, new TaskData(1){ Name = "Task B", ParentId = 0, StartDate = new DateTime(2023, 3, 1), EndDate = new DateTime(2023, 7, 1), ShowInTimeline = true }, new TaskData(2){ Name = "Task C", ParentId = 0, StartDate = new DateTime(2023, 7, 1), EndDate = new DateTime(2023, 11, 1) }, new TaskData(3){ Name = "Task D", ParentId = 0, StartDate = new DateTime(2023, 11, 1), EndDate = new DateTime(2024, 3, 31) }, }; } }
您可以打印/導(dǎo)出甘特圖及其時(shí)間軸,支持的導(dǎo)出文件格式包括:PDF, XLS, XLSX, MHT, CSV, HTML, RTF, DOCX, TXT(或作為圖像文件)。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都網(wǎng)