FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour change in the background color
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
change in the background color
Posted: Wed May 21, 2025 03:50 PM

There is an icon with a transparent background. Is it possible to show a change in the background color of this icon in FW ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: change in the background color
Posted: Wed May 21, 2025 04:08 PM
Dear Yuri,

It may be required to modify the Method Paint() of Class TIcon so it fills the background with a certain color:
METHOD Paint() CLASS TIcon
   LOCAL hBrush

   // Create a brush with the background color
   hBrush := CreateSolidBrush( ::nClrPane )

   // Fill the background
   FillRect( ::hDC, { 0, 0, ::nRight - ::nLeft, ::nBottom - ::nTop }, hBrush )

   // Clean up the brush
   DeleteObject( hBrush )

   // Draw the icon
   DrawIcon( ::hDC, 0, 0, ::hIcon )

RETURN nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: change in the background color
Posted: Wed May 21, 2025 04:15 PM

That is, instead of ::nClrPane, specify my fill color ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: change in the background color
Posted: Wed May 21, 2025 06:02 PM

Yes, thats the idea

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: change in the background color
Posted: Thu May 22, 2025 01:41 PM
I checked that the background of the icon does not change in this way. :(
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: change in the background color
Posted: Thu May 22, 2025 04:47 PM

Has the icon got a transparent area for its background ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: change in the background color
Posted: Thu May 22, 2025 05:07 PM

Yes

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: change in the background color
Posted: Thu May 22, 2025 06:18 PM

Can you provide an url to download the icon ?

thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: change in the background color
Posted: Thu May 22, 2025 06:44 PM

Continue the discussion