Displays the Get Shape dialog box, and gets the options for LPaintEffect::Draw3dShape.
#include "ltwrappr.h"
virtual L_INT LDialogEffect::DoModalGetShape ( 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::SetShapeParams must be called before using this function to set the initial values for the dialog. You can get the updated SHAPEDLGPARAMS with the values entered by the user through the dialog by using LDialogEffect::GetShapeParams.
L_INT LDialogEffect_DoModalGetShapeExample(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet;
LDialogEffect DlgEffect;
nRet = LDialogEffect::Initialize (0);
if(nRet != SUCCESS)
return nRet;
DlgEffect.SetBitmap(pBitmap);
LBitmap BackImage;
SHAPEDLGPARAMS DlgParams;
memset ( &DlgParams, 0, sizeof ( SHAPEDLGPARAMS ) ) ;
DlgParams.uStructSize = sizeof ( SHAPEDLGPARAMS ) ;
nRet = BackImage.Initialize ();
if(nRet != SUCCESS)
return nRet;
DlgParams.pBackgroundBitmap = BackImage.GetHandle();
DlgParams.uShape = EFX_SHAPE_PARALLELOGRAM_R ;
DlgParams.crBack = RGB ( 0, 0, 255 ) ;
DlgParams.uBackStyle = 2 ;
DlgParams.crFill = RGB ( 255, 0, 0 ) ;
DlgParams.uFillStyle = 1 ;
DlgParams.crBorder = RGB ( 100, 255, 100 ) ;
DlgParams.uBorderStyle = 1 ;
DlgParams.uBorderWidth = 5 ;
DlgParams.crInnerHilite = RGB ( 255, 255, 255 ) ;
DlgParams.crInnerShadow = RGB ( 0, 0, 0 ) ;
DlgParams.uInnerStyle = 1 ;
DlgParams.uInnerWidth = 3 ;
DlgParams.crOuterHilite = RGB ( 255, 255, 0 ) ;
DlgParams.crOuterShadow = RGB ( 255, 0, 255 ) ;
DlgParams.uOuterStyle = 1 ;
DlgParams.uOuterWidth = 5 ;
DlgParams.nShadowX = 10 ;
DlgParams.nShadowY = 10 ;
DlgParams.crShadow = RGB ( 128, 128, 128 ) ;
DlgParams.uDlgFlags = DLG_SHAPE_SHOW_PREVIEW |
DLG_SHAPE_AUTOPREVIEW |
DLG_SHAPE_BACKSTYLE |
DLG_SHAPE_FILLSTYLE |
DLG_SHAPE_FORE_BACK_COLOR |
DLG_SHAPE_BORDERSTYLE |
DLG_SHAPE_BORDERWIDTH |
DLG_SHAPE_BORDERCOLOR |
DLG_SHAPE_INNERSTYLE |
DLG_SHAPE_INNERWIDTH |
DLG_SHAPE_INNER_HILITE_SHADOW |
DLG_SHAPE_OUTERSTYLE |
DLG_SHAPE_OUTERWIDTH |
DLG_SHAPE_OUTER_HILITE_SHADOW |
DLG_SHAPE_SHADOWCOLOR |
DLG_SHAPE_SHADOW_X_Y |
DLG_SHAPE_BROWSEIMAGE |
DLG_SHAPE_CLASS_SQUARE |
DLG_SHAPE_CLASS_RECTANGLE |
DLG_SHAPE_CLASS_PARALLELOGRAM |
DLG_SHAPE_CLASS_TRAPEZOID |
DLG_SHAPE_CLASS_TRIANGLE |
DLG_SHAPE_CLASS_OTHER |
DLG_SHAPE_CLASS_CIRCLE |
DLG_SHAPE_CLASS_ELLIPSE |
DLG_SHAPE_CLASS_STAR |
DLG_SHAPE_CLASS_CROSS |
DLG_SHAPE_CLASS_ARROW ;
DlgEffect.EnableCallBack (FALSE);
nRet = DlgEffect.SetShapeParams(&DlgParams) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgEffect.DoModalGetShape(hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgEffect.GetShapeParams(&DlgParams, sizeof(DlgParams)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LDialogEffect::Free ();
if(nRet != SUCCESS)
return nRet;
if ( BackImage.IsAllocated() )
{
nRet = BackImage.Free ();
if(nRet != SUCCESS)
return nRet;
}
return SUCCESS;
}