FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour btnbmp on bitmap or pngs
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
btnbmp on bitmap or pngs
Posted: Tue Nov 11, 2025 11:20 AM

I need to know how I can make two btnbmp obtn on two obmp bitmaps that are on a dialog. ODLG
The bitmaps are one white and one black.
I set magenta as the background color in the image that uses the btnbmp (255, 0, 255).
The problem is that the btnbmp button is not transparent and always takes the color of the dialog whether I put it on the oBmp1 image or on the ODLG.
Both the bitmaps and the image that uses the btnbmp are 24 bits.

#include "FiveWin.ch"

STATIC cThemePath := ".\bitmaps\themes\default\"

Function test()
local oDlg
local oBmp1,oBmp2

 DEFINE DIALOG oDlg TITLE "test btnbmp su bmp" ;
          SIZE 340, 360 PIXEL

@ 10,0 BITMAP oBmp1 FILENAME cThemePath + "square1.bmp" OF oDlg;
        size 50,50 adjust noborder PIXEL
      oBmp1:nAlphaLevel := 100

@ 10,100 BITMAP oBmp2 FILENAME cThemePath + "square2.bmp" OF oDlg;
        size 50,50 adjust noborder PIXEL
      oBmp2:nAlphaLevel := 100

activate dialog oDlg ;
on init Put_btn(oBmp1,oBmp2)
return nil
//------------------------------------------------------//

Function Put_btn(oBmp1,oBmp2)
   local oBtn1,oBtn2

  @ 10, 10 BTNBMP oBtn1 ;
  FILENAME cThemePath + "rook0.bmp" ;
  SIZE 80,80 PIXEL OF oBmp1 FLAT NOBORDER  TRANSPARENT GDIP

  @ 10, 10 BTNBMP oBtn1 ;
  FILENAME cThemePath + "rook1.bmp" ;
  SIZE 80,80 PIXEL OF oBmp2 FLAT NOBORDER  TRANSPARENT GDIP

return nil

I also tried to use png files in the btnbmp but the btnbmp is not transparent and the background is always gray because it takes the color of the dialog, so I also tried with two pngs and two btnbmps with pngs on the pngs

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: btnbmp on bitmap or pngs
Posted: Tue Nov 11, 2025 02:31 PM

Dear Silvio,

#include "FiveWin.ch"

STATIC cThemePath := ".\bitmaps\themes\png\"

FUNCTION Main()

   LOCAL oDlg
   LOCAL oImg1, oImg2
   LOCAL oBtn1, oBtn2

   DEFINE DIALOG oDlg TITLE "Prueba de BTNBMP en PNG con canal alfa" ;
          SIZE 500, 500

   @ 20, 20 XIMAGE oImg1 ;
      FILENAME cThemePath + "square1.png" ;
      SIZE 80,80 OF oDlg NOBORDER
   oImg1:bLClicked = { || MsgInfo( "Has hecho clic en la imagen 1" ) }
   oImg1:FitRect()
   oImg1:bPainted = { || oImg1:DrawImage( cThemePath + "rook0.png" ) }            

   @ 20, 100 XIMAGE oImg2 ;
      FILENAME cThemePath + "square2.png" ;
      SIZE 80,80 OF oDlg NOBORDER

   oImg2:bLClicked = { || MsgInfo( "Ha hecho clic en la imagen 2" ) }
   oImg2:FitRect()
   oImg2:bPainted = { || oImg2:DrawImage( cThemePath + "rook1.png" ) }            

   ACTIVATE DIALOG oDlg CENTERED

   RETURN NIL
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion