border color of btnbmp

border color of btnbmp

Postby Silvio.Falconi » Fri Feb 07, 2020 3:35 pm

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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: border color of btnbmp

Postby ukoenig » Mon Feb 10, 2020 2:36 pm

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  Expand view

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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: border color of btnbmp

Postby Silvio.Falconi » Mon Feb 10, 2020 9:24 pm

But I think someone can modify the border of btnbmp easy add the value
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests