原創(chuàng)|其它|編輯:郝浩|2012-10-19 15:30:08.000|閱讀 870 次
概述:本文的代碼示例主要展示當(dāng)終端用戶按下Ctrl+Del 快捷鍵時(shí),刪除焦點(diǎn)行的操作。要處理按鍵事件,首先我們需要處理BaseView.KeyDown事件。然后通過調(diào)用ColumnView.DeleteRow 方法,刪除焦點(diǎn)行。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
本文的代碼示例主要展示當(dāng)終端用戶按下Ctrl+Del 快捷鍵時(shí),刪除焦點(diǎn)行的操作。要處理按鍵事件,首先我們需要處理BaseView.KeyDown事件。然后通過調(diào)用ColumnView.DeleteRow 方法,刪除焦點(diǎn)行。
C#
private void gridView1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Delete && e.Modifiers == Keys.Control) { if (MessageBox.Show("Delete row?", "Confirmation", MessageBoxButtons.YesNo) != DialogResult.Yes) return; GridView view = sender as GridView; view.DeleteRow(view.FocusedRowHandle); } }
VB
Private Sub GridView1_KeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) Handles GridView1.KeyDown If (e.KeyCode = Keys.Delete And e.Modifiers = Keys.Control) Then If (MessageBox.Show("Delete row?", "Confirmation", _ MessageBoxButtons.YesNo) <> DialogResult.Yes) Then Return Dim view As GridView = CType(sender, GridView) view.DeleteRow(view.FocusedRowHandle) End If End Sub
文章轉(zhuǎn)載自:
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:DevExpress中文網(wǎng)