.NET Framework Class Library DataGridViewCell..::.PreferredSize Property Gets the size, in pixels, of a rectangular area into which the cell can fit.
Namespace:
System.Windows.Forms
Assembly:
System.Windows.Forms (in System.Windows.Forms.dll)

Syntax
<BrowsableAttribute(False)> _
Public ReadOnly Property PreferredSize As Size
Get
[BrowsableAttribute(false)]
public Size PreferredSize { get; }
[BrowsableAttribute(false)]
public:
property Size PreferredSize {
Size get ();
}
[<BrowsableAttribute(false)>]
member PreferredSize : Size

Exceptions

Remarks
The PreferredSize property returns the natural size of the cell computed by the cell's owning row and column. PreferredSize returns a Size with a width and height of -1 if the cell is not contained in a table. If the cell is in a DataGridViewColumn that has its Resizable property set to false, -1 is returned for the width. This method relies on the GetFormattedValue method.

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

See Also
|
Biblioteca de clases de .NET Framework DataGridViewCell..::.PreferredSize (Propiedad) Obtiene el tamaño, en píxeles, de un área rectangular en la que cabe la celda.
Espacio de nombres:
System.Windows.Forms
Ensamblado:
System.Windows.Forms (en System.Windows.Forms.dll)

Sintaxis
<BrowsableAttribute(False)> _
Public ReadOnly Property PreferredSize As Size
Get
[BrowsableAttribute(false)]
public Size PreferredSize { get; }
[BrowsableAttribute(false)]
public:
property Size PreferredSize {
Size get ();
}
[<BrowsableAttribute(false)>]
member PreferredSize : Size

Excepciones

Comentarios
La propiedad PreferredSize devuelve el tamaño natural de la celda calculado por la fila y columna propietarias de la celda. Si la celda no está incluida en una tabla, PreferredSize devuelve una estructura Size con un ancho y un alto de -1. Si la celda está en una columna DataGridViewColumn cuya propiedad Resizable está establecida en false, se devuelve -1 para el ancho. Este método se basa en el método GetFormattedValue.

Información de versión
.NET FrameworkCompatible con: 4, 3.5, 3.0, 2.0 .NET Framework Client ProfileCompatible con: 4, 3.5 SP1

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Vea también
|