#include "l_bitmap.h"
L_LTDLG_API L_INT L_DlgGetShape(hWndOwner, pDlgParams)
Displays the Get Shape dialog box, and gets the options for L_EfxDraw3dShape.
Handle of the window which owns the dialog.
Pointer to a SHAPEDLGPARAMS 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 Shape dialog.
Required DLLs and Libraries
L_INT ShowDlgGetShapeExample(HWND hWnd, pBITMAPHANDLE pBitmap)
{
SHAPEDLGPARAMS DlgParams ;
BITMAPHANDLE BackBitmap ;
L_INT nRet ;
HDC hDC ;
HDC hBackDC ;
RECT rcDst ;
RECT rcBack ;
memset ( &DlgParams, 0,sizeof ( SHAPEDLGPARAMS ) ) ;
nRet = L_InitBitmap(&BackBitmap, sizeof(BITMAPHANDLE), 0, 0, 0 ) ;
if(nRet != SUCCESS)
return nRet;
DlgParams.uStructSize = sizeof ( SHAPEDLGPARAMS ) ;
DlgParams.pBitmap = pBitmap ;
DlgParams.pBackgroundBitmap = &BackBitmap;
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 ;
L_DlgInit ( DLG_INIT_COLOR ) ;
nRet = L_DlgGetShape ( hWnd, &DlgParams ) ;
if ( nRet == SUCCESS_DLG_OK )
{
hBackDC = L_CreateLeadDC( DlgParams.pBackgroundBitmap ) ;
SetRect ( &rcBack, 0, 0, DlgParams.pBackgroundBitmap->Width, DlgParams.pBackgroundBitmap->Height ) ;
hDC = GetDC ( hWnd ) ;
GetClientRect ( hWnd, &rcDst);
//now paint the shape
nRet = L_EfxDraw3dShape(hDC,
DlgParams.uShape,
&rcDst,
DlgParams.crBack,
hBackDC,
&rcBack,
DlgParams.uBackStyle,
DlgParams.crFill,
DlgParams.uFillStyle,
DlgParams.crBorder,
DlgParams.uBorderStyle,
DlgParams.uBorderWidth,
DlgParams.crInnerHilite,
DlgParams.crInnerShadow,
DlgParams.uInnerStyle,
DlgParams.uInnerWidth,
DlgParams.crOuterHilite,
DlgParams.crOuterShadow,
DlgParams.uOuterStyle,
DlgParams.uOuterWidth,
DlgParams.nShadowX,
DlgParams.nShadowY,
DlgParams.crShadow,
NULL ) ;
if(nRet != SUCCESS)
return nRet;
ReleaseDC ( hWnd, hDC ) ;
if ( NULL != hBackDC )
L_DeleteLeadDC( hBackDC ) ;
}
else
return nRet;
nRet = L_DlgFree();
if (nRet != SUCCESS)
return nRet;
if ( BackBitmap.Flags.Allocated )
L_FreeBitmap( &BackBitmap ) ;
return SUCCESS;
}