METHOD LoadBitmaps( cResName1, cResName2, cBmpFile1, cBmpFile2,;
cResName3, cBmpFile3, cResName4, cBmpFile4 ) CLASS TBtnBmp
local aBmpPal
if ! Empty( cResName1 )
IF FindResource( GetResources(), cResName1 , 10 ) != 0
::hBitmap1 = FILoadFromMemory( cResToStr( cResName1, 10 ), 10 )
::hPalette1 = 0
ELSE
aBmpPal = PalBmpLoad( cResName1 )
::hBitmap1 = aBmpPal[ 1 ]
::hPalette1 = aBmpPal[ 2 ]
endif
::HasAlpha( ::hBitmap1, BTN_UP )
endif
if ! Empty( cResName2 )
IF FindResource( GetResources(), cResName2 , 10 ) != 0
::hBitmap2 = FILoadFromMemory( cResToStr( cResName2, 10 ), 10 )
::hPalette2 = 0
ELSE
aBmpPal = PalBmpLoad( cResName2 )
::hBitmap2 = aBmpPal[ 1 ]
::hPalette2 = aBmpPal[ 2 ]
endif
::HasAlpha( ::hBitmap2, BTN_DOWN )
endif
if ! Empty( cResName3 )
IF FindResource( GetResources(), cResName3 , 10 ) != 0
::hBitmap3 = FILoadFromMemory( cResToStr( cResName3, 10 ), 10 )
::hPalette3 = 0
ELSE
aBmpPal = PalBmpLoad( cResName3 )
::hBitmap3 = aBmpPal[ 1 ]
::hPalette3 = aBmpPal[ 2 ]
endif
::HasAlpha( ::hBitmap3, BTN_DISABLE )
endif
if ! Empty( cResName4 )
IF FindResource( GetResources(), cResName4 , 10 ) != 0
::hBitmap4 = FILoadFromMemory( cResToStr( cResName4, 10 ), 10 )
::hPalette4 = 0
ELSE
aBmpPal = PalBmpLoad( cResName4 )
::hBitmap4 = aBmpPal[ 1 ]
::hPalette4 = aBmpPal[ 2 ]
endif
::HasAlpha( ::hBitmap4, BTN_OVERMOUSE )
endif
if ! Empty( cBmpFile1 )
if File( cBmpFile1 )
::cBmpFile1 = cBmpFile1
IF upper(right(cBmpFile1,3))="PNG"
::hBitmap1 = FWOpenPngFile( cBmpFile1 )
::hPalette1 = 0
else
aBmpPal = PalBmpRead( ::GetDC(), cBmpFile1 )
::hBitmap1 = aBmpPal[ 1 ]
::hPalette1 = aBmpPal[ 2 ]
endif
::HasAlpha( ::hBitmap1, BTN_UP )
::ReleaseDC()
endif
endif
if ! Empty( cBmpFile2 )
if File( cBmpFile2 )
::cBmpFile2 = cBmpFile2
IF upper(right(cBmpFile2,3))="PNG"
::hBitmap2 = FWOpenPngFile( cBmpFile2 )
::hPalette2 = 0
else
aBmpPal = PalBmpRead( ::GetDC(), cBmpFile2 )
::hBitmap2 = aBmpPal[ 1 ]
::hPalette2 = aBmpPal[ 2 ]
endif
::HasAlpha( ::hBitmap2, BTN_DOWN )
::ReleaseDC()
endif
endif
if ! Empty( cBmpFile3 )
if File( cBmpFile3 )
::cBmpFile3 = cBmpFile3
IF upper(right(cBmpFile3,3))="PNG"
::hBitmap3 = FWOpenPngFile( cBmpFile3 )
::hPalette3 = 0
else
aBmpPal = PalBmpRead( ::GetDC(), cBmpFile3 )
::hBitmap3 = aBmpPal[ 1 ]
::hPalette3 = aBmpPal[ 2 ]
endif
::HasAlpha( ::hBitmap3, BTN_DISABLE )
::ReleaseDC()
endif
endif
if ! Empty( cBmpFile4 )
if File( cBmpFile4 )
::cBmpFile4 = cBmpFile4
IF upper(right(cBmpFile4,3))="PNG"
::hBitmap4 = FWOpenPngFile( cBmpFile4 )
::hPalette4 = 0
else
aBmpPal = PalBmpRead( ::GetDC(), cBmpFile4 )
::hBitmap4 = aBmpPal[ 1 ]
::hPalette4 = aBmpPal[ 2 ]
endif
::HasAlpha( ::hBitmap4, BTN_OVERMOUSE )
::ReleaseDC()
endif
endif
if ! Empty( ::hBitmap1 )
PalBmpNew( ::hWnd, ::hBitmap1, ::hPalette1 )
endif
if ! Empty( ::hBitmap2 )
PalBmpNew( ::hWnd, ::hBitmap2, ::hPalette2 )
endif
if ! Empty( ::hBitmap3 )
PalBmpNew( ::hWnd, ::hBitmap3, ::hPalette3 )
endif
if ! Empty( ::hBitmap4 )
PalBmpNew( ::hWnd, ::hBitmap4, ::hPalette4 )
endif
return nil