DataGridViewCell.GetContentBounds Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the bounding rectangle that encloses the cell's content area.
Overloads
GetContentBounds(Int32) |
Returns the bounding rectangle that encloses the cell's content area using a default Graphics and cell style currently in effect for the cell. |
GetContentBounds(Graphics, DataGridViewCellStyle, Int32) |
Returns the bounding rectangle that encloses the cell's content area, which is calculated using the specified Graphics and cell style. |
GetContentBounds(Int32)
- Source:
- DataGridViewCell.cs
- Source:
- DataGridViewCell.cs
- Source:
- DataGridViewCell.cs
Returns the bounding rectangle that encloses the cell's content area using a default Graphics and cell style currently in effect for the cell.
public:
System::Drawing::Rectangle GetContentBounds(int rowIndex);
public System.Drawing.Rectangle GetContentBounds (int rowIndex);
member this.GetContentBounds : int -> System.Drawing.Rectangle
Public Function GetContentBounds (rowIndex As Integer) As Rectangle
Parameters
- rowIndex
- Int32
The index of the cell's parent row.
Returns
The Rectangle that bounds the cell's contents.
Exceptions
The specified rowIndex
is less than 0 or greater than the number of rows in the control minus 1.
ColumnIndex is less than 0, indicating that the cell is a row header cell.
Remarks
The size of the cell's contents is computed dynamically when this method is called. The base class implementation always returns Rectangle.Empty.
See also
Applies to
GetContentBounds(Graphics, DataGridViewCellStyle, Int32)
- Source:
- DataGridViewCell.cs
- Source:
- DataGridViewCell.cs
- Source:
- DataGridViewCell.cs
Returns the bounding rectangle that encloses the cell's content area, which is calculated using the specified Graphics and cell style.
protected:
virtual System::Drawing::Rectangle GetContentBounds(System::Drawing::Graphics ^ graphics, System::Windows::Forms::DataGridViewCellStyle ^ cellStyle, int rowIndex);
protected virtual System.Drawing.Rectangle GetContentBounds (System.Drawing.Graphics graphics, System.Windows.Forms.DataGridViewCellStyle cellStyle, int rowIndex);
abstract member GetContentBounds : System.Drawing.Graphics * System.Windows.Forms.DataGridViewCellStyle * int -> System.Drawing.Rectangle
override this.GetContentBounds : System.Drawing.Graphics * System.Windows.Forms.DataGridViewCellStyle * int -> System.Drawing.Rectangle
Protected Overridable Function GetContentBounds (graphics As Graphics, cellStyle As DataGridViewCellStyle, rowIndex As Integer) As Rectangle
Parameters
- graphics
- Graphics
The graphics context for the cell.
- cellStyle
- DataGridViewCellStyle
The DataGridViewCellStyle to be applied to the cell.
- rowIndex
- Int32
The index of the cell's parent row.
Returns
The Rectangle that bounds the cell's contents.
Remarks
The size of the cell's contents is computed dynamically when this method is called. The base class implementation always returns Rectangle.Empty.
This method is called internally when the ContentBounds property is read.