DataGridViewCell.PositionEditingControl Method

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

public virtual void PositionEditingControl (
	bool setLocation,
	bool setSize,
	Rectangle cellBounds,
	Rectangle cellClip,
	DataGridViewCellStyle cellStyle,
	bool singleVerticalBorderAdded,
	bool singleHorizontalBorderAdded,
	bool isFirstDisplayedColumn,
	bool isFirstDisplayedRow
public void PositionEditingControl (
	boolean setLocation, 
	boolean setSize, 
	Rectangle cellBounds, 
	Rectangle cellClip, 
	DataGridViewCellStyle cellStyle, 
	boolean singleVerticalBorderAdded, 
	boolean singleHorizontalBorderAdded, 
	boolean isFirstDisplayedColumn, 
	boolean isFirstDisplayedRow
public function PositionEditingControl (
	setLocation : boolean, 
	setSize : boolean, 
	cellBounds : Rectangle, 
	cellClip : Rectangle, 
	cellStyle : DataGridViewCellStyle, 
	singleVerticalBorderAdded : boolean, 
	singleHorizontalBorderAdded : boolean, 
	isFirstDisplayedColumn : boolean, 
	isFirstDisplayedRow : boolean
Not applicable.



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


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


A Rectangle that defines the cell bounds.


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


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


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


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


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


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

Exception typeCondition


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.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions