NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataGridBoolColumn.GetPreferredHeight

Gets the height used when resizing columns.

[Visual Basic]
Overrides Public Function GetPreferredHeight( _
   ByVal g As Graphics, _
   ByVal value As Object _
) As Integer
[C#]
public override int GetPreferredHeight(
   Graphics g,
   object value
);
[C++]
public: override int GetPreferredHeight(
   Graphics* g,
   Object* value
);
[JScript]
public override function GetPreferredHeight(
   g : Graphics,
   value : Object
) : int;

Parameters

g
A Graphics that draws on the screen.
value
An Object that contains the value to be drawn to the screen.

Return Value

The height used to automatically resize cells in a column.

Example [Visual Basic]

The following example uses the GetPreferredHeight to return the height required to draw a given value. The font size is changed, and a new height returned.

[Visual Basic]

Private Sub GetAutoSize()
   Dim obj As Object
   Dim g As Graphics
   obj = "a string"
   Set g = Me.CreateGraphics
   Dim sze As Integer
   sze = datagrid1.GridColumns(0).GetPreferredHeight(g, obj)
   Debug.Print sze
   Set datagrid1.Font = New System.Drawing.Font("Times Roman", 24!)
   sze = datagrid1.GridColumns(0).GetPreferredHeight(g, obj)
   Debug.Print sze
End Sub

See Also

DataGridBoolColumn Class | DataGridBoolColumn Members | System.WinForms Namespace | GetPreferredSize | GetMinimumHeight