Displays the Get Gradient dialog box, and gets the options for LPaintEffect::DrawGradient.
#include "ltwrappr.h"
virtual L_INT LDialogEffect::DoModalGetGradient ( 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::SetGradientParams must be called before using this function to set the initial values for the dialog. You can get the updated GRADIENTDLGPARAMS with the values entered by the user through the dialog by using LDialogEffect::GetGradientParams.
L_INT LDialogEffect_DoModalGetGradientExample(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet;
LDialogEffect DlgEffect;
nRet = LDialogEffect::Initialize (0);
if(nRet != SUCCESS)
return nRet;
DlgEffect.SetBitmap (pBitmap);
GRADIENTDLGPARAMS DlgParams;
memset ( &DlgParams, 0, sizeof ( GRADIENTDLGPARAMS ) ) ;
DlgParams.uStructSize = sizeof ( GRADIENTDLGPARAMS ) ;
DlgParams.crStart = RGB ( 0,0,255 ) ;
DlgParams.crEnd = RGB ( 255,0,0 ) ;
DlgParams.uStyle = EFX_GRADIENT_ANGLE_TO_RT ;
DlgParams.uSteps = 200 ;
DlgParams.uDlgFlags = DLG_GRADIENT_SHOW_PREVIEW |
DLG_GRADIENT_AUTOPREVIEW |
DLG_GRADIENT_STARTCOLOR |
DLG_GRADIENT_ENDCOLOR |
DLG_GRADIENT_STEPS |
DLG_GRADIENT_NO_TREEVIEW |
DLG_GRADIENT_CLASS_LINEAR |
DLG_GRADIENT_CLASS_ANGULAR |
DLG_GRADIENT_CLASS_RECTANGULAR |
DLG_GRADIENT_CLASS_ELLIPTICAL |
DLG_GRADIENT_CLASS_CONICAL ;
DlgEffect.EnableCallBack (FALSE);
nRet = DlgEffect.SetGradientParams (&DlgParams) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgEffect.DoModalGetGradient(hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgEffect.GetGradientParams (&DlgParams, sizeof(DlgParams)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LDialogEffect::Free ();
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}