Quite curious, now I tested here again and its fine
Please test this Class TBtnBmp Method Paint() (warning to other users: this is for testing only, don't use this code yet)
- Code: Select all Expand view
- METHOD Paint() CLASS TBtnBmp
local aInfo := ::DispBegin()
local hBmp := If( ::lPressed, If( Empty( ::hBitmap2 ), If( ::lMOver .and. ;
! Empty( ::hBitmap4 ), ::hBitmap4, ::hBitmap1 ),;
::hBitmap2 ), If( ! IsWindowEnabled( ::hWnd ) .and. ;
! Empty( ::hBitmap3 ), ::hBitmap3, If( ::lMOver .and. ;
! Empty( ::hBitmap4 ), ::hBitmap4, ::hBitmap1 ) ) )
local nBtn := If( ::lPressed, If( Empty( ::hBitmap2 ), If( ::lMOver .and. ;
! Empty( ::hBitmap4 ), 4, 1 ), 2 ),;
If( ! IsWindowEnabled( ::hWnd ) .and. ! Empty( ::hBitmap3 ),;
3, If( ::lMOver .and. ! Empty( ::hBitmap4 ), 4, 1 ) ) )
if ::lTransparent
SetBrushOrgEx( ::hDC, nBmpWidth( ::oWnd:oBrush:hBitmap ) - ::nLeft,;
nBmpHeight( ::oWnd:oBrush:hBitmap ) - ::nTop )
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oWnd:oBrush:hBrush )
else
if Empty( ::bClrGrad )
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
else
if ::aGrad != nil
GradientFill( ::hDC, 0, 0, ::nHeight, ::nWidth, ::aGrad() )
endif
endif
endif
if ! Empty( hBmp )
if ::lBmpTransparent
if SetAlpha() .and. ::aAlpha[ nBtn ]
ABPaint( ::hDC, If( ::lPressed, 1, 0 ), If( ::lPressed, 1, 0 ),;
hBmp, ::nAlphaLevel() )
else
DrawTransBmp( ::hDC, hBmp, If( ::lPressed, 1, 0 ),;
If( ::lPressed, 1, 0 ), ::nWidth, ::nHeight )
endif
else
DrawTransBmp( ::hDC, hBmp, If( ::lPressed, 1, 0 ),;
If( ::lPressed, 1, 0 ), ::nWidth, ::nHeight )
endif
endif
::DispEnd( aInfo )
return nil