You can use GDIPLUS.
Draw a border around a button with a defined pensize , distance and with a defined radius
Code: Select all
oDlg:bPainted := < |hDC|
DRAWBORDER( hDC, oBtn[1]:nLeft -4, oBtn[1]:nTop -4, ;
oBtn[1]:nWidth +6, oBtn[1]:nHeight +6, 5, 5, 255 ), ; // Btn-border
DRAWLIGHT( hDC, oBtn[17]:nLeft -2, oBtn[17]:nTop -2, ;
oBtn[17]:nWidth +4, oBtn[17]:nHeight +4, 5, 5, 255 ) )
RETURN NIL
>
// -----------------
FUNCTION DRAWBORDER ( hDC, nLeft, nTop, nWidth, nHeight, nRadius, nPen, nRGBColor )
LOCAL oGraphics := Graphics():New( hDC )
LOCAL nRed := nRGBRed( nRGBColor )
LOCAL nGreen := nRGBGreen( nRGBColor )
LOCAL nBlue := nRGBBlue( nRGBColor )
LOCAL oPen, oPath
IF nRadius > 0
oPath := Path():new()
oPen := Pen():New( 255, nRed, nGreen, nBlue, nPen)
oPath:AddRoundRect( nLeft, nTop, nWidth, nHeight, nRadius )
oGraphics:DrawPath( oPen, oPath )
ELSE
oPen := Pen():New( 255, nRed, nGreen, nBlue, nPen )
oGraphics:DrawRect( oPen, ,nLeft, nTop, nWidth, nHeight )
ENDIF
oPen:Destroy()
oGraphics:destroy()
RETURN NIL
// ------------------
FUNCTION DRAWLIGHT(hDC, nLeft, nTop, nWidth, nHeight, nRadius, nPen, nRGBColor)
LOCAL oGraphics := Graphics():New( hDC )
LOCAL oPen
LOCAL n
LOCAL nRed := nRGBRed( nRGBColor )
LOCAL nGreen := nRGBGreen( nRGBColor )
LOCAL nBlue := nRGBBlue( nRGBColor )
oPen := Pen():New( 255 , 0, 0 , 0 )
oGraphics:DrawRoundRect( oPen, , nLeft, nTop, nWidth, nHeight )
oPen:SetColor( 255 , nRed, nGreen, nBlue )
oPen:Setsize(1)
FOR n = 1 to 10
oPen:Setcolor( 255 -n*25 , nRed, nGreen, nBlue )
oGraphics:DrawRoundRect( oPen, , nLeft -n , nTop -n, nWidth +n*2 , nHeight +n*2 )
NEXT
oPen:Destroy()
oGraphics:Destroy()
RETURN NIL