CellButtonClick當(dāng)用戶單擊單元格上的編輯按鈕時(shí)觸發(fā)此事件。通常,此事件用于彈出單元格的自定義編輯器(例如,用于選擇顏色、日期、文件、圖片、自定義輸入窗口等的對(duì)話框)。默認(rèn)情況下,單元格編輯按鈕顯示在單元格的右側(cè),帶有省略號(hào)標(biāo)題(“...”)。它們類似于PropertyGrid控件中顯示的按鈕,位于圖像屬性旁邊。你可以通過將圖片指定給BaseGrid.CellButtonImage來自定義按鈕的外觀。要在單元格上創(chuàng)建編輯按鈕,必須設(shè)置BaseGrid.AllowEditing屬性為true并設(shè)置BaseGrid.Cols("列名稱").ComboList屬性為“...”或“|...”?!皘...”表示允許用戶直接在單元格里面輸入文本內(nèi)容。
下面是e參數(shù)可以獲得的對(duì)象清單
Vb.Net |
Public Sub SmGrid1_CellButtonClick(sender As Object,e As C1.Win.C1FlexGrid.RowColEventArgs) Dim tbl As SmGrid=sender '表中RowCol參數(shù)主要包含行、列值 Dim intRow As Integer=e.Row Dim intCol As Integer=e.Col '我們可以依據(jù)行列信息進(jìn)而獲得 Dim strColName As String=tbl.Cols(intCol).Name '獲得ColData對(duì)象 Dim dc As ColData=tbl.DataTableHelp.DataCols(strColName) '獲得ColBase對(duì)象 Dim dvc As ColBase=tbl.View.ViewCols(strColName) '獲得RowData對(duì)象 Dim dr As RowData=tbl.Rows(intRow).GetRowData() End Sub |
C# |
public void SmGrid1_CellButtonClick(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { SmGrid tbl = sender as SmGrid; // 表中RowCol參數(shù)主要包含行、列值 int intRow = e.Row; int intCol = e.Col; // 我們可以依據(jù)行列信息進(jìn)而獲得 string strColName = tbl.Cols[intCol].Name; // 獲得ColData對(duì)象 ColData dc = tbl.DataTableHelp.DataCols[strColName]; // 獲得ColBase對(duì)象 ColBase dvc = tbl.View.ViewCols[strColName]; // 獲得RowData對(duì)象 RowData dr = tbl.Rows[intRow].GetRowData(); } |