I tried a small prg to show a background file png and two button ( btnbmp) with png file into a Wnd
I have some problems as you can see
the btnbmp are not transparent
- Code: Select all Expand view RUN
- #include "FiveWin.ch"
Static c_path,c_path1,oBackground
function Main()
local oWnd
local oBtn[2]
c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_Path + "IMAGES\"
DEFINE IMAGE oBackground FILENAME c_path1 + "Back.png"
DEFINE WINDOW oWnd FROM 10, 10 TO 48,110
@ 200, 450 BTNBMP oBtn[1] OF oWnd ;
SIZE 80, 80 ;
PROMPT "";
NOBORDER ;
FILE c_Path1 + "Pay.png" ;
ACTION MsgInfo("Pay")
oBtn[1]:lEllipse := .T.
oBtn[1]:lTransparent := .T.
@ 350, 520 BTNBMP oBtn[2] OF oWnd ;
SIZE 120, 80 ;
PROMPT "";
NOBORDER ;
FILE c_Path1 + "Spin.png" ;
ACTION MsgInfo("spin")
oBtn[2]:lTransparent := .T.
ACTIVATE WINDOW oWnd ;
ON PAINT ( ABPaint( hDC, 50, 10, oBackground:hBitmap, 255 ) )
// another test ON PAINT PaintTransparent( hDC, oBackground:hBitmap, 0, 0 )
//-----------------------------------------------------------------------------//
function PaintTransparent( hDC, hBitmap, nRow, nCol )
local hBmpOld := SelectObject( hDC, hBitmap )
local nZeroZeroClr := GetPixel( hDC, 0, 0 )
local nOldClr
SelectObject( hDC, hBmpOld )
nOldClr = SetBkColor( hDC, nRGB( 255, 255, 255 ) )
TransBmp( hBitmap, nBmpWidth( hBitmap ), nBmpHeight( hBitmap ),;
nZeroZeroClr, hDC, nRow, nCol, nBmpWidth( hBitmap ), nBmpHeight( hBitmap ) )
SetBkColor( hDC, nOldClr )
return nil