Sets the specified paint properties.
#include "Ltwrappr.h"
L_INT LRasterPaint::SetProperty(nGroup, pProperty)
Indicates the paint properties to get and the structure pointed to by pProperty. Possible values are:
Value | Meaning |
---|---|
PAINT_GROUP_BRUSH | Sets the Paintbrush properties. pProperty points to a PAINTBRUSH structure. |
PAINT_GROUP_SHAPE | Sets the Paint shape properties. pProperty points to a PAINTSHAPE structure. |
PAINT_GROUP_REGION | Sets the Paint region properties. pProperty points to a PAINTREGION structure. |
PAINT_GROUP_FILL | Sets the Paint fill properties. pProperty points to a PAINTFILL structure. |
PAINT_GROUP_TEXT | Sets 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 |
L_INT LRasterPaint_SetPropertyExample(CWnd* pWnd)
{
L_INT nRet;
LRasterPaint rstp;
PAINTSHAPE shape ;
CDC* pDC = pWnd->GetDC();
RECT rcShapeRect ;
RECT rcDCExtents ;
/* Initiate the Paint toolkit */
nRet = rstp.Initialize ( );
if(nRet != SUCCESS)
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 = rstp.SetProperty ( PAINT_GROUP_SHAPE, &shape ) ;
if(nRet != SUCCESS)
return nRet;
/* Set the rectangle coordinates with respect to the DC dimensions*/
SetRect ( &rcShapeRect, 10, 10, 110, 110 ) ;
/* Get the destination DC dimensions */
pWnd->GetClientRect ( &rcDCExtents ) ;
/* Set the toolkit user DC extents */
nRet = rstp.SetDCExtents ( &rcDCExtents ) ;
if(nRet != SUCCESS)
return nRet;
/* Use the current shape properties to draw a rectangle*/
nRet = rstp.DrawShapeRectangle ( pDC->m_hDC, &rcShapeRect ) ;
if(nRet != SUCCESS)
return nRet;
/* Release the device context*/
pWnd->ReleaseDC( pDC ) ;
// Free the paint tools handle.
nRet = rstp.Free ( ) ;
if(nRet != SUCCESS)
return nRet;
return SUCCESS ;
}