Antonio,
tested, but doesn't work.
The Result :
My Test and
Function returns a adjusted Dialog ( a little bit more complicated ) :
Some space between Dlg-top / Text-top and Dlg-bottom / Text-bottom.
Can be adjusted to Dlg-top = Text-top and Dlg-bottom = Text-bottom
A little Test-tool, selecting any Font and changing Size and Style :
( I added only a small Space for g, j, p, q and y on Bottom )
You can change the top, left, right and bottom-space.
A INI-file is used, to save and restore a Font.
For the calculated
Dialog-height, some Adjustments are needed.
For the
Textheight :
oFont1 := TFont():New("Arial",,-nFSize,.F.,.T. ,,,,.F. )
nTxtHeight := INT( Abs( oFont1:nHeight ) ) + 22
( nFSize is selected, 22 = Height of Dialog-title )
For the calculated
Textwidth and Dialog-size I used :
- Code: Select all Expand view
// -- calculated Text-width ----------------
FUNCTION TEXT_W( oSay, nTxtHeight )
hDC := oSay:GetDC()
IF oFont1:lItalic = .F. // Italic
nTxtWidth := INT( GettextWidth( hDC, ALLTRIM(cText), oFont1:hFont, ) ) + 6
ELSE
nTxtWidth := INT( GettextWidth( hDC, ALLTRIM(cText), oFont1:hFont, ) ) + 8
ENDIF
oSay:ReleaseDC()
oSay:nWidth := nTxtWidth
// 15 = added Space on Bottom
// ---------------------------------
oDlg2:Move( nPosT, nPosL, nTxtWidth, nTxtHeight + 15, .T. )
oSay:Refresh()
RETURN ( NIL )
Best regards
Uwe