Displays the Get Text dialog box, and gets the options for LPaintEffect::Draw3dText.
#include "ltwrappr.h"
virtual L_INT LDialogEffect::DoModalGetText(hWndOwner)
Handle of the window which owns the dialog.
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. |
LDialogEffect::SetTextParams must be called before using this function to set the initial values for the dialog. You can get the updated TEXTDLGPARAMS with the values entered by the user through the dialog by using LDialogEffect::GetTextParams.
L_INT LDialogEffect_DoModalGetTextExample(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet;
LDialogEffect DlgEffect;
nRet = LDialogEffect::Initialize (0);
if(nRet != SUCCESS)
return nRet;
DlgEffect.SetBitmap (pBitmap);
TEXTDLGPARAMS DlgParams;
LBitmap ForeImage;
L_TCHAR szSampleText [ L_MAXPATH ] ;
memset ( &DlgParams, 0, sizeof ( TEXTDLGPARAMS ) ) ;
DlgParams.uStructSize = sizeof ( TEXTDLGPARAMS ) ;
nRet = ForeImage.Initialize ();
if(nRet != SUCCESS)
return nRet;
DlgParams.pForegroundBitmap = ForeImage.GetHandle() ;
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 ;
DlgEffect.EnableCallBack (FALSE);
nRet = DlgEffect.SetTextParams (&DlgParams) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgEffect.DoModalGetText(hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgEffect.GetTextParams (&DlgParams, sizeof(DlgParams)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LDialogEffect::Free ();
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}