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

 

Sets the location and size of the editing control hosted by a cell in the DataGridView control.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

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
Type: System.Boolean

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

setSize
Type: System.Boolean

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

cellBounds
Type: System.Drawing.Rectangle

A Rectangle that defines the cell bounds.

cellClip
Type: System.Drawing.Rectangle

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

cellStyle
Type: System.Windows.Forms.DataGridViewCellStyle

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

singleVerticalBorderAdded
Type: System.Boolean

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

singleHorizontalBorderAdded
Type: System.Boolean

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

isFirstDisplayedColumn
Type: System.Boolean

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

isFirstDisplayedRow
Type: System.Boolean

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

Exception Condition
InvalidOperationException

The cell is not contained within a DataGridView control.

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.

.NET Framework
Available since 2.0
Return to top
Show: