翻譯|使用教程|編輯:莫成敏|2019-07-10 14:22:46.637|閱讀 286 次
概述:VARCHART XGantt?是一個交互式的甘特圖控件,其模塊化的設計讓您可以創建滿足您和您的客戶所需求的應用程序。本文只要介紹肖像照增強甘特圖的視覺效果。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VARCHART XGantt是一個交互式的甘特圖控件,其模塊化的設計讓您可以創建滿足您和您的客戶所需求的應用程序。VARCHART XGantt可以快速、簡單地集成到您的應用程序中,幫助您識別性能瓶頸、避免延遲以及高效利用資源,使復雜數據變得更加容易理解。
想象一下,您的Gantt chart是按員工分組的,顯示每位員工的資源負荷圖表(直方圖)。 在這種情況下,在直方圖旁邊顯示員工的照片將為您的應用程序增添很大的視覺價值。
如何在.NET甘特圖的直方圖中顯示圖像
下面的屏幕截圖讓您了解我們想要實現的目標:將John,James和Jane的照片放在直方圖旁邊,這樣您就可以立即(直觀地)了解他們的工作量。
使用代碼添加照片
事件VcObjectDrawn允許您使用自己的程序代碼,豐富.NET Gantt控件VARCHART XGantt在設計方面繪制的對象。要繪制圖片,請在設計時勾選“編輯直方圖”對話框的“色帶”區域中所需色帶的“對象顯示”選項。 由于此選項僅適用于功能區類型“Textual”,因此您可能必須添加另一個功能區。
在VcObjectDrawn事件中執行以下代碼:
private void vcGantt1_VcObjectDrawn(object sender, VcObjectDrawnEventArgs e) { Graphics g = e.Graphics; Bitmap myBM = null; switch (e.ObjectType) { case VcObjectType.vcObjTypeNumericScale: //Get the coordinates of a point in the numeric scale int x = e.UpdateRect.Right - 5; int y = e.UpdateRect.Top + 5; //Identify in which histogram we are object identObj = null; VcObjectType identObjType = VcObjectType.vcObjTypeNone; vcGantt1.IdentifyObjectAt(x, y, ref identObj, ref identObjType); VcHistogram histo = (VcHistogram)identObj; switch (histo.Name) { case "A": myBM = new Bitmap(Application.StartupPath + @"\..\..\Bitmaps\Image1.png"); //photo credit: kinojam via photopin cc break; case "B": myBM = new Bitmap(Application.StartupPath + @"\..\..\Bitmaps\Image2.png"); //photo credit: Enthuan via photopin cc break; case "C": myBM = new Bitmap(Application.StartupPath + @"\..\..\Bitmaps\Image3.png"); //photo credit: chris zerbes via photopin cc break; default: break; } //Draw the bitmaps in the numeric scales of the histograms x = e.CompleteRect.Left + 50; y = e.CompleteRect.Top + e.CompleteRect.Height / 2 - 50; g.DrawImage(myBM, x, y, 80, 90); break; } }
希望這篇文章能對您有幫助~
想要購買VARCHART XGantt正版授權,或者獲取更多該產品相關信息的朋友可以點擊
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn