#include "LtPnt.h"
L_LTPNT_API L_INT L_PntBrushMoveTo(pPaint, UserDC, nX, nY)
Updates the current position of the paintbrush and paints a single brush touch.
Pointer to a paint handle.
Handle to a device context, such as a screen, to use as a display surface. This parameter can also be NULL. The mapping mode of the device context must be MM_TEXT.
Specifies the x-coordinate of the new position.
Specifies the y-coordinate of the new position.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The paintbrush touch will be drawn using the current paintbrush properties. To determine the current paintbrush properties, call L_PntGetProperty. To set or change the current paintbrush properties, call L_PntSetProperty. For more information on the paintbrush properties, refer to the PAINTBRUSH structure.
If UserDC is not NULL, the toolkit will paint the paintbrush touch on the specified device context. If UserDC is NULL, the paintbrush touch will not be painted on a device context.
If a bitmap has been set using the L_PntSetMetrics function, the paintbrush touch will be drawn on the specified bitmap. If UserDC is not NULL and a bitmap has been set using the L_PntSetMetrics function, then the paintbrush touch will be drawn to both the device context and the bitmap.
Required DLLs and Libraries
L_INT PntBrushMoveToExample(HWND hWnd)
{
L_INT nRet;
pPAINTHANDLE pPaint ;
HDC hDC;
PAINTBRUSH brush;
/* Initiate the Paint toolkit */
nRet = L_PntInit ( &pPaint );
if ( SUCCESS != nRet )
{
return nRet;
}
/* Get device context to draw on */
hDC = GetDC ( hWnd ) ;
/* Get the current paintbrush properties */
nRet = L_PntGetProperty ( pPaint, PAINT_GROUP_BRUSH, &brush ) ;
if(nRet != SUCCESS)
return nRet;
/* Set the required paintbrush properties */
brush.nSize = sizeof ( PAINTBRUSH ) ;
brush.dwMask = PBF_DIAMETER |
PBF_TOUCH |
PBF_SPACING ;
brush.nDiameter = 20 ;
brush.Touch.crColor = RGB ( 255, 0, 0 ) ;
brush.nSpacing = 25 ;
/* Set the new paintbruch properties */
nRet = L_PntSetProperty ( pPaint, PAINT_GROUP_BRUSH, &brush ) ;
if(nRet != SUCCESS)
return nRet;
/* Use the current paintbruch properties to draw a paintbruch strock to DC (hDC) */
nRet = L_PntBrushMoveTo ( pPaint, hDC, 10, 10 ) ;
if(nRet != SUCCESS)
return nRet;
nRet = L_PntBrushLineTo ( pPaint, hDC, 100, 100 ) ;
if(nRet != SUCCESS)
return nRet;
/* Release the device context */
ReleaseDC ( hWnd, hDC ) ;
/* Free the paint tools handle */
L_PntFree ( pPaint ) ;
return SUCCESS ;
}