Edytuj

Udostępnij za pośrednictwem


DataGridBoolColumn.GetPreferredSize(Graphics, Object) Method

Definition

Gets the optimum width and height of a cell given a specific value to contain.

protected public:
 override System::Drawing::Size GetPreferredSize(System::Drawing::Graphics ^ g, System::Object ^ value);
protected internal override System.Drawing.Size GetPreferredSize (System.Drawing.Graphics g, object value);
override this.GetPreferredSize : System.Drawing.Graphics * obj -> System.Drawing.Size
Protected Friend Overrides Function GetPreferredSize (g As Graphics, value As Object) As Size

Parameters

g
Graphics

A Graphics that draws the cell.

value
Object

The value that must fit in the cell.

Returns

A Size that contains the drawing information for the cell.

Remarks

The GetPreferredSize method allows you to resize the column based on the value displayed. For example, if a cell contains an especially large value, you can use the GetPreferredSize method to return the optimum size of the cell based on the value. The optimum size takes into account not only the size of the string, but also the font used to display it.

Applies to

See also