DataGridBoolColumn.GetPreferredSize(Graphics, Object) 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.
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
- 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.