แก้ไข

แชร์ผ่าน


DataGridViewCell.PositionEditingControl Method

Definition

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)

Parameters

setLocation
Boolean

true to have the control placed as specified by the other arguments; false to allow the control to place itself.

setSize
Boolean

true to specify the size; false to allow the control to size itself.

cellBounds
Rectangle

A Rectangle that defines the cell bounds.

cellClip
Rectangle

The area that will be used to paint the editing control.

cellStyle
DataGridViewCellStyle

A DataGridViewCellStyle that represents the style of the cell being edited.

singleVerticalBorderAdded
Boolean

true to add a vertical border to the cell; otherwise, false.

singleHorizontalBorderAdded
Boolean

true to add a horizontal border to the cell; otherwise, false.

isFirstDisplayedColumn
Boolean

true if the hosting cell is in the first visible column; otherwise, false.

isFirstDisplayedRow
Boolean

true if the hosting cell is in the first visible row; otherwise, false.

Exceptions

The cell is not contained within a DataGridView control.

Remarks

Some classes derived from the DataGridViewCell class, such as DataGridViewComboBoxCell, host a control in the selected cell. The PositionEditingControl method positions the editing control inside of the host cell. 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.

Applies to

See also