DataGridViewCell.PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) 方法

定义

设置由 DataGridView 控件中的单元格承载的编辑控件的位置和大小。Sets the location and size of the editing control hosted by a cell in the DataGridView control.

public:
 virtual void PositionEditingControl(bool setLocation, bool setSize, System::Drawing::Rectangle cellBounds, System::Drawing::Rectangle cellClip, System::Windows::Forms::DataGridViewCellStyle ^ cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow);
public virtual void PositionEditingControl (bool setLocation, bool setSize, System.Drawing.Rectangle cellBounds, System.Drawing.Rectangle cellClip, System.Windows.Forms.DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow);
abstract member PositionEditingControl : bool * bool * System.Drawing.Rectangle * System.Drawing.Rectangle * System.Windows.Forms.DataGridViewCellStyle * bool * bool * bool * bool -> unit
override this.PositionEditingControl : bool * bool * System.Drawing.Rectangle * System.Drawing.Rectangle * System.Windows.Forms.DataGridViewCellStyle * bool * bool * bool * bool -> unit
Public Overridable Sub PositionEditingControl (setLocation As Boolean, setSize As Boolean, cellBounds As Rectangle, cellClip As Rectangle, cellStyle As DataGridViewCellStyle, singleVerticalBorderAdded As Boolean, singleHorizontalBorderAdded As Boolean, isFirstDisplayedColumn As Boolean, isFirstDisplayedRow As Boolean)

参数

setLocation
Boolean

若要将控件置于其他参数指定的位置,则为 true;如要允许控件自行放置,则为 falsetrue to have the control placed as specified by the other arguments; false to allow the control to place itself.

setSize
Boolean

若要指定大小,则为 true;若要允许控件自行调整大小,则为 falsetrue to specify the size; false to allow the control to size itself.

cellBounds
Rectangle

定义单元格界限的 RectangleA Rectangle that defines the cell bounds.

cellClip
Rectangle

将用于绘制编辑控件的区域。The area that will be used to paint the editing control.

cellStyle
DataGridViewCellStyle

一个 DataGridViewCellStyle,它表示被编辑单元格的样式。A DataGridViewCellStyle that represents the style of the cell being edited.

singleVerticalBorderAdded
Boolean

若要向单元格添加竖框线,则为 true;否则为 falsetrue to add a vertical border to the cell; otherwise, false.

singleHorizontalBorderAdded
Boolean

若要向单元格添加横框线,则为 true;否则为 falsetrue to add a horizontal border to the cell; otherwise, false.

isFirstDisplayedColumn
Boolean

如果宿主单元格位于第一个可见列中,则为 true;否则为 falsetrue if the hosting cell is in the first visible column; otherwise, false.

isFirstDisplayedRow
Boolean

如果宿主单元格位于第一个可见行中,则为 true;否则为 falsetrue if the hosting cell is in the first visible row; otherwise, false.

异常

DataGridView 控件中不包含该单元格。The cell is not contained within a DataGridView control.

注解

一些派生自 DataGridViewCell 类的类(如 DataGridViewComboBoxCell)在所选单元格中承载控件。Some classes derived from the DataGridViewCell class, such as DataGridViewComboBoxCell, host a control in the selected cell. PositionEditingControl 方法将编辑控件定位到主机单元格内。The PositionEditingControl method positions the editing control inside of the host cell. 由于编辑控件可能占用比单个单元格更多的空间,因此,在编辑第一个可见列或第一个可见行中的单元格时,可能需要以不同的方式定位,因此它不会绘制在 DataGridView之外。Because the editing control may take up more space than a single cell, it may need to be positioned differently when editing a cell in the first visible column or first visible row so it does not paint outside the DataGridView.

适用于

另请参阅