Using Win32 functions in Visual FoxPro Image Gallery
GDI+ Text
..msdn
GdipDrawString
GdipMeasureString
Code examples:
Custom GDI+ class
GdipMeasureString
..msdn    Add comment     W32 Constants      Translate this page
Measures the extent of the string in the specified font, format, and layout rectangle.
Code examples:
Custom GDI+ class
Declaration:
GpStatus WINGDIPAPI GdipMeasureString(
    GpGraphics *graphics,
    GDIPCONST WCHAR *string,
    INT length,
    GDIPCONST GpFont *font,
    GDIPCONST RectF *layoutRect,
    GDIPCONST GpStringFormat *stringFormat,
    RectF *boundingBox,
    INT *codepointsFitted,
    INT *linesFilled
)
FoxPro declaration:
DECLARE INTEGER GdipMeasureString IN gdiplus;
    INTEGER graphics,;
    STRING utxt,;
    INTEGER length,;
    INTEGER fnt,;
    STRING @layoutRect,;
    INTEGER stringFormat,;
    STRING @boundingBox,;
    INTEGER @codepointsFitted,;
    INTEGER @linesFilled
Parameters:
graphics
[in] Pointer to a Graphics object.

string
[in] Pointer to a wide-character string to be measured.

length
[in] Integer that specifies the number of characters in the string array. The length parameter can be set to ?1 if the string is null terminated.

font
[in] Pointer to a Font object that specifies the family name, size, and style of the font that is applied to the string.

layoutRectSize
[in] Reference to a SizeF object that specifies the width and height of a rectangle that bounds the string.

stringFormat
[in] Pointer to a StringFormat object that specifies the layout information, such as alignment, trimming, tab stops, and so forth.

size
[out] Pointer to a SizeF object that receives the width and height of the rectangle that bounds the string.

codepointsFitted
[out] Optional. Pointer to an INT that receives the number of characters that actually fit into the layout rectangle. The default value is a NULL pointer.

linesFilled
[out] Optional. Pointer to an INT that receives the number of lines that actually fit into the layout rectangle. The default value is a NULL pointer.
Return value:
If the method succeeds, it returns OK (0).
Usage:
THIS.errorcode = GdipMeasureString(THIS.graphics,;
    STRCONV(m.cStr+CHR(0),5),;
    LEN(m.cStr), oFont.fnt, cRectSrc,;
    fmt.fmt, @cRectDst,;
    @nCharsFitted, @nLinesFitted)
My comment:
Read Doug Hennig"s article Forget TXTWIDTH - use GdipMeasureString.

See also: GetTextExtentPoint32, FONTMETRICS(), TXTWIDTH(), WFONT( )
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2006-05-09 22:18:51
Modified: 2007-06-11 16:18:54
Visited in last 7 days: 18
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.234.247.118)
15 sec.Function: 'FatalAppExit'
29 sec.Function: 'CloseWindow'
47 sec.Function: 'GdipGetImagePaletteSize'
1.08 min.Function: 'CeDeleteFile'
1.37 min.Function: 'CommitTransaction'
1.63 min.
Function group: 'Brush'
1.9 min.Function: 'GdipSetWorldTransform'
2.17 min.Function: 'BeginUpdateResource'
2.45 min.Function: 'FillMemory'
2.75 min.Function: 'GdipDrawImageRectRectI'
Google
Advertise here!