#include "LtPnt.h"
L_LTPNT_API L_INT L_PntSetProperty(pPaint, nGroup, pProperty)
Sets the specified paint properties.
Pointer to a paint handle.
Indicates the paint properties to get and the structure pointed to by pProperty. Possible values are:
Value | Meaning |
---|---|
PAINT_GROUP_BRUSH | Set the Paintbrush properties. pProperty points to a PAINTBRUSH structure. |
PAINT_GROUP_SHAPE | Set the Paint shape properties. pProperty points to a PAINTSHAPE structure. |
PAINT_GROUP_REGION | Set the Paint region properties. pProperty points to a PAINTREGION structure. |
PAINT_GROUP_FILL | Set the Paint fill properties. pProperty points to a PAINTFILL structure. |
PAINT_GROUP_TEXT | Set the Paint fill properties. pProperty points to a PAINTTEXT structure. |
Pointer to a PAINTXXX structure that contains the property values to set. The type of structure that this parameter points to is indicated by the nGroup parameter. The user should set the nSize and dwMask of any of the PAINTXXX structures with proper values before calling this function.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
This example shows the minimum requirements for painting a rectangle shape. using some user defined properties.
L_INT PntSetPropertyExample(HWND hWnd)
{
L_INT nRet;
pPAINTHANDLE pPaint ;
PAINTSHAPE shape ;
HDC hDC ;
RECT rcShapeRect ;
/* Initiate the Paint toolkit */
nRet = L_PntInit ( &pPaint );
if ( SUCCESS != nRet )
{
return nRet;
}
/* Set the desired shape properties using the field masks*/
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BACKGROUNDSTYLE |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERWIDTH |
PSF_BORDERENDCAP |
PSF_GRADIENTSTYLE |
PSF_GRADIENTSTARTCOLOR|
PSF_GRADIENTENDCOLOR |
PSF_GRADIENTSTEPS ;
shape.nBackgroundStyle = PAINT_SHAPE_BACK_STYLE_GRADIENT;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DOT ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderWidth = 10 ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;
shape.nGradientStyle = PAINT_SHAPE_GRADIENT_STYLE_CONE_FROM_L ;
shape.crGradientStartColor = RGB ( 255, 192, 0 ) ;
shape.crGradientEndColor = RGB ( 0, 0, 255 ) ;
shape.uGradientSteps = 255 ;
/*Set the paint shape group properties */
nRet = L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;
if(nRet != SUCCESS)
return nRet;
/*Get the device context */
hDC = GetDC ( hWnd ) ;
/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ;
/* Set the DC Extents */
RECT rcClient;
GetClientRect(hWnd, &rcClient);
nRet = L_PntSetDCExtents ( pPaint, &rcClient );
/* Use the current shape properties to draw a rectangle*/
nRet = L_PntDrawShapeRectangle ( pPaint, hDC, &rcShapeRect ) ;
if(nRet != SUCCESS)
return nRet;
/* Release the device context*/
ReleaseDC ( hWnd, hDC ) ;
// Free the paint tools handle.
L_PntFree ( pPaint ) ;
return SUCCESS ;
}