lcString1 = 'State' lcString2 = 'Federal' lcString3 = 'State, transfer to Federal' lcMessage = PadWidth(lcString1,'.',50) + TRANSFORM(1) + CHR(13) + ; PadWidth(lcString2,'.',50) + TRANSFORM(2) + CHR(13) + ; PadWidth(lcString3,'.',50) + TRANSFORM(3) MESSAGEBOX(lcMessage,64,'My Message') RETURN * *=================================================== * FUNCTION PadWidth * LPARAMETERS tcString,tcPadChar,tnWidth,tcFontType * LOCAL ; lcFont,; lnFontSize,; lcFontType,; lnPadCharWidth,; lnStringWidth,; lnI,; lcReturn lcFontType = IIF(EMPTY(tcFontType),'N',tcFontType) lcFont = WFONT(1) lnFontSize = WFONT(2) lnStringWidth = 0 FOR lnI = 1 TO LEN(tcString) lnStringWidth = lnStringWidth + TXTWIDTH(SUBSTR(tcString,lnI,1),lcFont,lnFontSize,lcFontType) ENDFOR IF lnStringWidth >= tnWidth lcReturn = tcString ELSE lnPadCharWidth = TXTWIDTH(tcPadChar,lcFont,lnFontSize,lcFontType) lcReturn = tcString + REPLICATE(tcPadChar,ROUND((tnWidth - lnStringWidth)/lnPadCharWidth,0)) ENDIF RETURN lcReturn * *==================================================== * End: PadWidth *====================================================