原創|其它|編輯:郝浩|2012-10-09 10:47:09.000|閱讀 675 次
概述:以下的例子展示了如何將ChartControl添加到Windows窗體應用程序中。注意圖表控件可以在設計時和運行時添加到你的圖表應用程序中。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
以下的例子展示了如何將ChartControl添加到Windows窗體應用程序中。注意圖表控件可以在設計時和運行時添加到你的圖表應用程序中。
設計時
默認狀態下, ChartControl項被添加進VS IDE的DX.12.1:Data工具箱選項卡中。就這樣,簡單地拖拽相應的工具箱項目,把它放置于窗體應上就可以把圖表控件加到你的項目中。
注意:當添加ChartControl時,會調用到圖表向導窗口。如果你不想用到它點擊“取消”,或者按照軟件的步驟來定制你的圖表的初始輪廓。
運行時
運行時添加一個圖表控件到窗體,不要忘了把所有必需的組件添加到你項目中的參考列表中。
using System.Drawing; using System.Windows.Forms; using DevExpress.XtraCharts; // ... private void OnButtonClick(object sender, System.EventArgs e) { // Create a new Chart control. ChartControl chart = new ChartControl(); // Set the chart's location. chart.Location = new Point(10, 10); // Perform any other initialization here. // ... // ... // Add the chart to the Form. this.Controls.AddRange(new Control[] {chart}); }
Imports System.Drawing Imports System.Windows.Forms Imports DevExpress.XtraCharts ' ... Private Sub OnButtonClick(sender As Object, e As System.EventArgs) _ Handles Button1.Click ' Create a new Chart control. Dim chart As New ChartControl() ' Set the chart's location. chart.Location = New Point(10, 10) ' Perform any other initialization here. ' ... ' ... ' Add the chart to the Form. Me.Controls.AddRange(New Control() {chart}) End Sub
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:DevExpress中文網