Skip to main content
A newer version of this page is available. .

BaseControl.CalcBestSize() Method

Calculates the minimum size the control needs to be to contain its contents.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v18.2.dll

Declaration

public virtual Size CalcBestSize()

Returns

Type Description
Size

A System.Drawing.Size object representing the minimum size of the control that will best fit its content.

Remarks

This method returns the minimum control size required to fit the control’s content including the offset from each control’s border.

You can use this method when creating a control at runtime to ensure that the control’s contents are completely visible.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CalcBestSize() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also