border color of btnbmp

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

border color of btnbmp

Post by Silvio.Falconi »

Image


I made

AEval( aBtn, { |o| o:nClrBorder := IIF(o:lMOver,rgb(119,162,217),CLR_GRAY) } )

how I can make to change the size of border ?

another image

Image

this happen when I move the mouse on first btnbmp

the blue color of the button actually goes beyond the border, so it's ugly to see
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: border color of btnbmp

Post by ukoenig »

Silvio,
You can use GDIPLUS.
Draw a border around a button with a defined pensize , distance and with a defined radius

Image

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

 
regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: border color of btnbmp

Post by Silvio.Falconi »

But I think someone can modify the border of btnbmp easy add the value
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply