DataGridViewCell.KeyPressUnsharesRow(KeyPressEventArgs, Int32) 方法

定义

指示在焦点位于该行的单元格上并同时按任意键时,是否取消行的共享。Indicates whether a row will be unshared if a key is pressed while a cell in the row has focus.

protected:
 virtual bool KeyPressUnsharesRow(System::Windows::Forms::KeyPressEventArgs ^ e, int rowIndex);
protected virtual bool KeyPressUnsharesRow (System.Windows.Forms.KeyPressEventArgs e, int rowIndex);
abstract member KeyPressUnsharesRow : System.Windows.Forms.KeyPressEventArgs * int -> bool
override this.KeyPressUnsharesRow : System.Windows.Forms.KeyPressEventArgs * int -> bool
Protected Overridable Function KeyPressUnsharesRow (e As KeyPressEventArgs, rowIndex As Integer) As Boolean

参数

e
KeyPressEventArgs

包含事件数据的 KeyPressEventArgsA KeyPressEventArgs that contains the event data.

rowIndex
Int32

该单元格的父行索引。The index of the cell's parent row.

返回

如果不共享该行,则为 true;否则为 falsetrue if the row will be unshared, otherwise, false. DataGridViewCell 基类总是返回 falseThe base DataGridViewCell class always returns false.

注解

KeyPressUnsharesRow 方法刚好在 OnKeyPress 方法之前调用。The KeyPressUnsharesRow method is called just before the OnKeyPress method. 在派生类中,如果对 OnKeyPress 的调用具有取消共享包含该单元格的行的效果,则该方法必须返回 trueIn derived classes, it must return true if the call to OnKeyPress has the effect of unsharing the row containing the cell. 否则,它应返回 falseOtherwise, it should return false.

有关行共享的详细信息,请参阅缩放 Windows 窗体 DataGridView 控件的最佳做法For more information about row sharing, see Best Practices for Scaling the Windows Forms DataGridView Control.

适用于

另请参阅