// -------------- CIRCLE -----
STATIC FUNCTION CL_ROUND( hMemDC, nStyle )
LOCAL hOldBrush, oBrush
LOCAL hOldPen := SELECTOBJECT( hMemDC, hPen )
IF nStyle = 1 // transparent
DEFINE BRUSH oBrush STYLE NULL
ELSE
DEFINE BRUSH oBrush COLOR nPenColor
ENDIF
hOldBrush := SelectObject( hMemDC, oBrush:hBrush )
IF nWFactor > 1 .and. nHFactor > 1 // image < painting area
MOVETO( hMemDC, aPoints[ 1, 2 ], aPoints[ 1, 1 ] )
ROUNDRECT( hMemDC, aPoints[ 1, 2 ], ; // Left
aPoints[ 1, 1 ], ; // Top
aPoints[ 1, 2 ] + ( nCircle * ( nLIResize / 100 ) ), ; // Right
aPoints[ 1, 1 ] + ( nCircle * ( nLIResize / 100 ) ), ; // Bottom
nCircle * ( nLIResize / 100 ), ; // Width
nCircle * ( nLIResize / 100 ) ) // Height
ELSE // image > painting area
IF nWFactor < nHFactor .OR. nWFactor < 1 .and. nHFactor > 1
MOVETO( hMemDC, aPoints[ 1, 2 ] / nWFactor, aPoints[ 1, 1 ] / nWFactor )
ROUNDRECT( hMemDC, aPoints[ 1, 2 ] / nWFactor, ; // Left
aPoints[ 1, 1 ] / nWFactor, ; // Top
( aPoints[ 1, 2 ] / nWFactor ) + ;
( ( nCircle / nWFactor ) * ( nLIResize / 100 ) ), ; // Right
( aPoints[ 1, 1 ] / nWFactor ) + ;
( ( nCircle / nWFactor ) * ( nLIResize / 100 ) ), ; // Bottom
nCircle / nWFactor * ( nLIResize / 100 ), ; // Width
nCircle / nWFactor * ( nLIResize / 100 ) ) // Height
ENDIF
IF nWFactor > nHFactor .OR. nWFactor > 1 .and. nHFactor < 1
MOVETO( hMemDC, aPoints[ 1, 2 ] / nHFactor, aPoints[ 1, 1 ] / nHFactor )
ROUNDRECT( hMemDC, aPoints[ 1, 2 ] / nHFactor, ; // Left
aPoints[ 1, 1 ] / nHFactor, ; // Top
( aPoints[ 1, 2 ] / nHFactor ) + ;
( ( nCircle / nHFactor ) * ( nLIResize / 100 ) ), ; // Right
( aPoints[ 1, 1 ] / nHFactor ) + ;
( ( nCircle / nHFactor ) * ( nLIResize / 100 ) ), ; // Bottom
nCircle / nHFactor * ( nLIResize / 100 ), ; // Width
nCircle / nHFactor * ( nLIResize / 100 ) ) // Height
ENDIF
ENDIF
DeleteObject( hOldPen )
DeleteObject( oBrush )
DeleteObject( hOldBrush )
// C5RoundRect( hMemDC, 80, 80, 400, 400, 250, 250 )
// That function is just a wrapper for the Windows API function RoundRect()
// In order to use a brush with it,
// you should first create the brush
// and select it to the current hDC and later on,
// save the current brush using
// hOldBrush := SelectObject( hDC, oBrush:hBrush ),
// paint,
// select the previous brush with SelectObject( hDC, hOldBrush )
// and finally destroy the brush ( oBrush:End() )
RETURN NIL