DataGridViewCell.PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) DataGridViewCell.PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) DataGridViewCell.PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) DataGridViewCell.PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) Method

定义

设置由 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 Boolean Boolean Boolean

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

setSize
Boolean Boolean Boolean Boolean

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

cellBounds
Rectangle Rectangle Rectangle Rectangle

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

cellClip
Rectangle Rectangle Rectangle Rectangle

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

cellStyle
DataGridViewCellStyle DataGridViewCellStyle DataGridViewCellStyle DataGridViewCellStyle

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

singleVerticalBorderAdded
Boolean Boolean Boolean Boolean

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

singleHorizontalBorderAdded
Boolean Boolean Boolean Boolean

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

isFirstDisplayedColumn
Boolean Boolean Boolean Boolean

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

isFirstDisplayedRow
Boolean Boolean Boolean 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. 编辑控件可能会占用更多的空间比单个单元格,因为它可能需要编辑第一个可见行的第一个可见列中的单元格,因此不会绘制之外时以不同的方式定位DataGridViewBecause 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.

适用于

另请参阅