Gets the specified paint properties.
#include "LtPnt.h"
L_LTPNT_API L_INT L_PntGetProperty(pPaint, nGroup, pProperty)
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 | Get the Paintbrush properties. pProperty points to a PAINTBRUSH structure. |
PAINT_GROUP_SHAPE | Get the Paint shape properties. pProperty points to a PAINTSHAPE structure. |
PAINT_GROUP_REGION | Get the Paint region properties. pProperty points to a PAINTREGION structure. |
PAINT_GROUP_FILL | Get the Paint fill properties. pProperty points to a PAINTFILL structure. |
PAINT_GROUP_TEXT | Get the Paint fill properties. pProperty points to a PAINTTEXT structure. |
Pointer to a PAINTXXX structure to be updated with the specified property values. The type of structure that this parameter points to is indicated by the nGroup parameter.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
If this function is called after the paint handle is initialized, the default values will be returned. For more information about the default property values, refer to:
This example shows the minimum requirements for painting a rectangle shape
using some user defined properties.
L_INT PntGetPropertyExample(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 paint shape group properties */
nRet = L_PntGetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;
if(nRet != SUCCESS)
return nRet;
/* Do some check and chang to the required properties*/
if ( PAINT_SHAPE_BORDER_STYLE_SOLID == shape.nBorderStyle )
{
/* Set the desired shape properties using the field masks*/
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERSTYLE |
PSF_BORDERWIDTH |
PSF_BORDERENDCAP;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DOT ;
shape.nBorderWidth = 10 ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;
/*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 an 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 ;
}