Page 1 of 1

border color of btnbmp

Posted: Fri Feb 07, 2020 3:35 pm
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

Re: border color of btnbmp

Posted: Mon Feb 10, 2020 2:36 pm
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

Re: border color of btnbmp

Posted: Mon Feb 10, 2020 9:24 pm
by Silvio.Falconi
But I think someone can modify the border of btnbmp easy add the value