#include "ltpdg.h"
L_LTPDG_API L_INT L_PntDlgText(hWnd, pTextDlgInfo)
Brings up the text properties dialog box.
Handle of the window that owns the dialog.
Pointer to a PAINTDLGTEXTINFO structure that contains text information. The values present in pTextDlgInfo when the function is called are used to initialize the dialog, if PAINT_DLG_TEXT_INITUSEDEFAULT is not set in the dwFlags member of pTextDlgInfo. When this function returns, this parameter is updated with the values entered through the dialog.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
This example will display the Text common dialog.
L_INT PntDlgTextExample(HWND hWnd,L_BOOL fUseDef)
{
L_INT nRet;
L_TCHAR * g_ppszBackgroundTileBitmap [ ] = { TEXT("Tile 0"),
TEXT("Tile 1"),
TEXT("Tile 2"),
TEXT("Tile 3"),
TEXT("Tile 4"),
TEXT("Tile 5") };
LOGFONT lf ;
PAINTTRANSFORM Painttransform ;
PAINTDLGTEXTINFO dlgTextInfo;
memset(&dlgTextInfo, 0, sizeof(dlgTextInfo));
if ( fUseDef == TRUE )
{
dlgTextInfo.dwFlags = PAINT_DLG_TEXT_INITUSEDEFAULT | PAINT_DLG_TEXT_SHOWALL ;
}
else
{
lf.lfHeight = 48;
lf.lfWidth = 0 ;
lf.lfEscapement = 0 ;
lf.lfOrientation = 0 ;
lf.lfWeight = FW_NORMAL ;
lf.lfItalic = FALSE ;
lf.lfUnderline = FALSE ;
lf.lfStrikeOut = FALSE ;
lf.lfCharSet = ANSI_CHARSET ;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;
lf.lfQuality = DEFAULT_QUALITY ;
lf.lfPitchAndFamily = FF_DONTCARE ;
lstrcpy(lf.lfFaceName, TEXT("Times New Roman") ) ;
Painttransform.nRotate = 45 ;
Painttransform.Scale.cx = 200 ;
Painttransform.Scale.cy = 200 ;
dlgTextInfo.nSize = sizeof ( PAINTDLGTEXTINFO ) ;
dlgTextInfo.dwFlags = PAINT_DLG_TEXT_SHOWTEXT |
PAINT_DLG_TEXT_SHOWBKGRNDSTYLE |
PAINT_DLG_TEXT_SHOWBKGRNDOPAQUECOLOR |
PAINT_DLG_TEXT_SHOWBKGRNDTILE |
PAINT_DLG_TEXT_SHOWBORDERWIDTH |
PAINT_DLG_TEXT_SHOWBORDERCOLOR |
PAINT_DLG_TEXT_SHOWHORZALIGNMENT |
PAINT_DLG_TEXT_SHOWVERTALIGNMENT |
PAINT_DLG_TEXT_SHOWROTATE |
PAINT_DLG_TEXT_SHOWSCALE |
PAINT_DLG_TEXT_SHOWTRUETYPEFONT |
PAINT_DLG_TEXT_SHOWOPACITY |
PAINT_DLG_TEXT_SHOWDEFAULT ;
dlgTextInfo.pszTitle = TEXT("Lead Text Common Dialog ") ;
dlgTextInfo.pszText = TEXT("Test Test Test");
dlgTextInfo.logFont = lf ;
dlgTextInfo.nBorderWidth = 10 ;
dlgTextInfo.crBorderColor = RGB ( 0, 0, 255 ) ;
dlgTextInfo.nBackgroundStyle = PAINT_TEXT_BACK_STYLE_TILEDIMAGE;
dlgTextInfo.crBackgroundColor = RGB ( 255, 0, 0 ) ;
dlgTextInfo.ppszBackgroundTileBitmap = g_ppszBackgroundTileBitmap ;
dlgTextInfo.uBackgroundTileBitmapCount = 6 ;
dlgTextInfo.nActiveBackgroundTileBitmapItem = 2 ;
dlgTextInfo.nAlignment = ( PAINTALIGNMENT )
( PAINT_ALIGNMENT_RIGHT |
PAINT_ALIGNMENT_VCENTER );
dlgTextInfo.nOpacity = 10 ;
dlgTextInfo.TransformInfo = Painttransform ;
}
nRet = L_PntDlgText ( hWnd, &dlgTextInfo ) ;
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}