ITextServices::TxGetNaturalSize method (textserv.h)
Allows a control to be resized so it fits its content appropriately.
const SIZEL *psizelExtent,
[in, out] LONG *pwidth,
[in, out] LONG *pheight
The aspect for the drawing. It can be any of the values from the DVASPECT enumeration.
The device context into which drawing occurs.
The device context for which text should be formatted (that is, for WYSIWYG).
More information on the target device.
The type of fitting requested. It can be one of the following.
|Use English Metric Units (EMUs) instead of pixels as the measuring units for this method's parameters.
Resize the control to fit the entire text by formatting the text to the width that is passed in. The text services object returns the height of the entire text and the width of the widest line.
For example, this should be done when the user double-clicks one of the control's handles.
|Resize the control so that it fits indented content.
|Resize the control so that it fits indented content and trailing whitespace.
|Resize the control so that it fits unindented content and trailing whitespace.
|For a plain-text control, include the height of the final carriage return when calculating the size.
Resize the control to show an integral number of lines (no line is clipped). Format enough text to fill the width and height that is passed in, and then return a height that is rounded to the nearest line boundary.
Note The passed and returned width and height correspond to the view rectangle. The host should adjust back to the client rectangle as needed. Because these values represent the extent of the text object, they are input and output in HIMETRIC coordinates (each HIMETRIC unit is .01 millimeter), and measuring does not include any zoom factor. For a discussion of the zoom factor, see TxGetExtent.
Type: const SIZEL*
[in, out] pwidth
The width for the fitting defined by dwMode.
[in, out] pheight
The height for the fitting defined by dwMode.
If the method succeeds, the return value is S_OK.
If text services could not activate the object, the return value is one of the following HRESULT codes. For more information on COM error codes, see Error Handling in COM.
|Unable to determine correct size.
|One or more arguments are not valid.
The first four parameters are similar to equivalent parameters in ITextServices::TxDraw and give the same information. In the case where the lines must be recalculated, it should use these values the same ways as in ITextServices::TxDraw.
The pwidth and pheight parameters are in/out parameters. The host passes in the tentative width and height of the natural extent of the text object. The text services object compares these values against its current cached state, and if different, recalculate lines. Then, it computes and returns the natural size, as specified by dwMode.
|Minimum supported client
|Windows Vista [desktop apps only]
|Minimum supported server
|Windows Server 2003 [desktop apps only]