DataGridBoolColumn::GetPreferredSize Method (Graphics^, Object^)

 
Use BaseTrue

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

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

public protected:
virtual Size GetPreferredSize(
	Graphics^ g,
	Object^ value
) override

Parameters

g
Type: System.Drawing::Graphics^

A Graphics that draws the cell.

value
Type: System::Object^

The value that must fit in the cell.

Return Value

Type: System.Drawing::Size

A Size that contains the drawing information for the cell.

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.

.NET Framework
Available since 1.1
Return to top
Show: