原創|其它|編輯:郝浩|2012-10-23 09:36:02.000|閱讀 300 次
概述:本文通過一個具體事例來給大家演示,如何實現DevExpress顯示與單元格相關的數據庫數據。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
示例圖如下:
我們點擊第一列1994年下面的第三行單元格數據,就會顯示出與這個單元格相關聯的數據庫數據:
代碼如下:
C#
using DevExpress.XtraPivotGrid;
private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) {
// Create a new form.
Form form = new Form();
form.Text = "Records";
// Place a DataGrid control on the form.
DataGrid grid = new DataGrid();
grid.Parent = form;
grid.Dock = DockStyle.Fill;
// Get the recrd set associated with the current cell and bind it to the grid.
grid.DataSource = e.CreateDrillDownDataSource();
form.Bounds = new Rectangle(100, 100, 500, 400);
// Display the form.
form.ShowDialog();
form.Dispose();
}
VB
Imports DevExpress.XtraPivotGrid Private Sub pivotGridControl1_CellDoubleClick(ByVal sender As Object, _ ByVal e As PivotCellEventArgs) Handles pivotGridControl1.CellDoubleClick ' Create a new form. Dim form As Form = New Form form.Text = "Records" ' Place a DataGrid control on the form. Dim grid As DataGrid = New DataGrid grid.Parent = form grid.Dock = DockStyle.Fill ' Get the recrd set associated with the current cell and bind it to the grid. grid.DataSource = e.CreateDrillDownDataSource() form.Bounds = New Rectangle(100, 100, 500, 400) ' Display the form. form.ShowDialog() form.Dispose() End Sub
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉載自:慧都控件網