#include "l_bitmap.h"
L_LTDLG_API L_INT L_DlgGetText(hWndOwner, pDlgParams)
Displays the Get Text dialog box, and gets the options for L_EfxDrawRotated3dText.
Handle of the window which owns the dialog.
Pointer to a TEXTDLGPARAMS structure to be updated with the values entered by the user, through the dialog. Set members of this structure, before calling this function, to set the dialogs initial values.
Value | Meaning |
---|---|
SUCCESS_DLG_OK | The "OK" button was pressed, and the dialog exited successfully. |
SUCCESS_DLG_CANCEL | The "Cancel" button was pressed, and the dialog exited successfully. |
< 1 | An error occurred. Refer to Return Codes. |
The Get Text dialog.
Required DLLs and Libraries
L_INT ShowDlgGetTextExample(HWND hWnd,pBITMAPHANDLE pBitmap)
{
L_INT nRet;
L_TCHAR szSampleText [ L_MAXPATH ] ;
TEXTDLGPARAMS DlgParams ;
BITMAPHANDLE ForeBitmap ;
HDC hDC ;
HDC hForeDC ;
RECT rcDst ;
memset ( &DlgParams, 0, sizeof ( TEXTDLGPARAMS ) ) ;
lstrcpy ( szSampleText, TEXT("LEADTOOLS!") ) ;
nRet = L_InitBitmap(&ForeBitmap, sizeof(BITMAPHANDLE), 0, 0, 0 ) ;
if(nRet != SUCCESS)
return nRet;
DlgParams.uStructSize = sizeof ( TEXTDLGPARAMS ) ;
DlgParams.pBitmap = pBitmap ;
DlgParams.pForegroundBitmap = &ForeBitmap ;
DlgParams.pszSampleText = szSampleText ;
DlgParams.nMaxCount = 180 ;
DlgParams.crText = RGB ( 0,0,255 ) ;
DlgParams.crHilite = RGB ( 255,255,255 ) ;
DlgParams.crShadow = RGB ( 128,128,128 ) ;
DlgParams.uStyle = 0 ;
DlgParams.uAlign = EFX_TEXT_HCENTER | EFX_TEXT_VCENTER ;
DlgParams.bWordWrap = FALSE ;
DlgParams.nAngle = 450 ;
DlgParams.hFont = NULL ;
DlgParams.nXDepth = 10 ;
DlgParams.nYDepth = 10 ;
DlgParams.bUseForeImage = TRUE ;
DlgParams.uDlgFlags = DLG_TEXT_SHOW_PREVIEW |
DLG_TEXT_AUTOPREVIEW |
DLG_TEXT_SAMPLETEXT |
DLG_TEXT_STYLE |
DLG_TEXT_COLOR |
DLG_TEXT_BORDERCOLOR |
DLG_TEXT_ALIGN |
DLG_TEXT_ANGLE |
DLG_TEXT_WORDWRAP |
DLG_TEXT_FONT |
DLG_TEXT_FOREIMAGE |
DLG_TEXT_BROWSEIMAGE |
DLG_TEXT_SHADOWCOLOR |
DLG_TEXT_SHADOW_X_Y ;
nRet = L_DlgInit ( DLG_INIT_COLOR ) ;
if(nRet != SUCCESS && nRet != ERROR_DLG_ALREADYINITIATED)
return nRet;
nRet = L_DlgGetText ( hWnd, &DlgParams );
if ( SUCCESS_DLG_OK == nRet )
{
hForeDC = NULL ;
if ( DlgParams.bUseForeImage )
{
hForeDC = L_CreateLeadDC( &ForeBitmap ) ;
}
hDC = GetDC ( hWnd ) ;
GetClientRect ( hWnd, &rcDst ) ;
nRet = L_EfxDrawRotated3dText(hDC,
DlgParams.pszSampleText,
&rcDst,
DlgParams.nAngle,
DlgParams.uStyle | DlgParams.uAlign |
( DlgParams.bWordWrap ) ? EFX_TEXT_WORDWRAP : 0,
DlgParams.nXDepth,
DlgParams.nYDepth,
DlgParams.crText,
DlgParams.crShadow,
DlgParams.crHilite,
DlgParams.hFont,
hForeDC ) ;
if(nRet != SUCCESS)
return nRet;
ReleaseDC ( hWnd, hDC ) ;
if ( hForeDC )
L_DeleteLeadDC( hForeDC ) ;
}
else if(nRet < 1 )
return nRet;
nRet = L_DlgFree();
if(nRet != SUCCESS)
return nRet;
if ( DlgParams.hFont )
DeleteObject ( DlgParams.hFont ) ;
if ( ForeBitmap.Flags.Allocated )
L_FreeBitmap( &ForeBitmap ) ;
return SUCCESS;
}