Bypass read only cells in DataGridView when pressing TAB key

前端 未结 8 720
粉色の甜心
粉色の甜心 2020-12-31 18:07

Can anyone show me some code of how I could bypass read only cells in DatagridView when pressing TAB key?

8条回答
  •  清酒与你
    2020-12-31 18:09

    Inherit DataGridView and override ProcessDialogKey (for key pressed while editing) and ProcessDataGridViewKey (for key pressed while not editing). When Tab was pressed, set CurrentCell to the next non-readonly cell.

    Optionally override WndProc to filter mouse clicks on readonly cells. (See DataGridView.GetColumnDisplayRectangle to find which column was clicked).

    Good source to start from here.

提交回复
热议问题