Start with the project you created in Using the Automation Editing Capabilities.
Add the following popup menu structure to the main menu you created in Implementing the Paint Automation Initializing, Creating and Freeing
&Properties
&Shape with ID = IDM_PROPERTIES_SHAPE
Add the following include statement at the end in Stdafx.h:
#include "C:\LEADTOOLS22\Include\ltpdg.h"
Add the following function definition before the OnOpen function definition:
static L_VOID OnShapeProperties(HWND hWnd, pAUTOMATIONHANDLE pAutomation)
{
PAINTSHAPE shape;
PAINTDLGSHAPEINFO ShapeDlgInfo;
L_INT nRet;
L_AutGetPaintProperty(pAutomation, PAINT_GROUP_SHAPE, &shape);
ShapeDlgInfo.dwFlags = PAINT_DLG_SHAPE_SHOWALL;
ShapeDlgInfo.pszTitle = TEXT("Shape Properties");
ShapeDlgInfo.nBackgroundStyle = shape.nBackgroundStyle;
ShapeDlgInfo.crBackgroundColor = shape.crBackgroundColor;
ShapeDlgInfo.ppszBackgroundTileBitmap = NULL;
ShapeDlgInfo.uBackgroundTileBitmapCount = 0;
ShapeDlgInfo.nActiveBackgroundTileBitmapItem = -1;
ShapeDlgInfo.nBorderStyle = shape.nBorderStyle;
ShapeDlgInfo.nBorderBrushStyle = shape.nBorderBrushStyle;
ShapeDlgInfo.crBorderColor = shape.crBorderColor;
ShapeDlgInfo.ppszBorderTileBitmap = NULL;
ShapeDlgInfo.uBorderTileBitmapCount = 0;
ShapeDlgInfo.nActiveBorderTileBitmapItem = -1;
ShapeDlgInfo.nBorderWidth = shape.nBorderWidth;
ShapeDlgInfo.nBorderEndCap = shape.nBorderEndCap;
ShapeDlgInfo.nGradientStyle = shape.nGradientStyle;
ShapeDlgInfo.crGradientStartColor = shape.crGradientStartColor;
ShapeDlgInfo.crGradientEndColor = shape.crGradientEndColor;
ShapeDlgInfo.uGradientSteps = shape.uGradientSteps;
ShapeDlgInfo.nRoundRectEllipseWidth = shape.nRoundRectEllipseWidth;
ShapeDlgInfo.nRoundRectEllipseHeight = shape.nRoundRectEllipseHeight;
ShapeDlgInfo.nOpacity = shape.nOpacity;
ShapeDlgInfo.ppszPaperTexture = NULL;
ShapeDlgInfo.uPaperTextureCount = 0;
ShapeDlgInfo.nActivePaperTextureItem = -1;
nRet = L_PntDlgShape(hWnd, &ShapeDlgInfo);
if (SUCCESS == nRet)
{
shape.nSize = sizeof(PAINTSHAPE);
shape.dwMask = PSF_ALL;
shape.nBackgroundStyle = ShapeDlgInfo.nBackgroundStyle;
shape.crBackgroundColor = ShapeDlgInfo.crBackgroundColor;
shape.pBackgroundTileBitmap = NULL;
shape.nBorderStyle = ShapeDlgInfo.nBorderStyle;
shape.nBorderBrushStyle = ShapeDlgInfo.nBorderBrushStyle;
shape.crBorderColor = ShapeDlgInfo.crBorderColor;
shape.hBorderTileBitmap = NULL;
shape.nBorderWidth = ShapeDlgInfo.nBorderWidth;
shape.nBorderEndCap = ShapeDlgInfo.nBorderEndCap;
shape.nGradientStyle = ShapeDlgInfo.nGradientStyle;
shape.crGradientStartColor = ShapeDlgInfo.crGradientStartColor;
shape.crGradientEndColor = ShapeDlgInfo.crGradientEndColor;
shape.uGradientSteps = ShapeDlgInfo.uGradientSteps;
shape.nRoundRectEllipseWidth = ShapeDlgInfo.nRoundRectEllipseWidth;
shape.nRoundRectEllipseHeight = ShapeDlgInfo.nRoundRectEllipseHeight;
shape.nOpacity = ShapeDlgInfo.nOpacity;
shape.pTexture = NULL;
L_AutSetPaintProperty(pAutomation, PAINT_GROUP_SHAPE, &shape);
}
}
Add the following line to the WndProc
function after the statement "return 0L ;" of the case IDM_EDIT_DELETE
in the WM_COMMAND
message:
case IDM_PROPERTIES_SHAPE:
OnShapeProperties ( hWnd, pAutomation ) ;
return 0L ;
Compile and run the project by selecting Build->Execute tutorial.exe from the menu.