METHOD Paint() CLASS TBitmap
local aInfo := ::DispBegin(), hBmpOld, nZeroZeroClr, nOldClr
local nAlphaLevel, hBitmap
if .f. //IsAppThemed() .and. Empty( ::oBrush:hBitmap ) // temporary fix for transparency on windows when themes are used
DrawPBack( ::hWnd, ::hDC )
else
#ifdef __CLIPPER__
SetBrushOrgEx( ::hDC, 8 - ::nLeft() % 8, 8 - ::nTop() % 8 )
#else
SetBrushOrgEx( ::hDC, nBmpWidth( ::oBrush:hBitmap ) - ::nLeft, nBmpHeight( ::oBrush:hBitmap ) - ::nTop )
#endif
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oWnd:oBrush:hBrush )
endif
#include "FiveWin.ch"
#include "folder.ch"
#include "image.ch"
static ownd
Function main()
local oBmp
DEFINE BITMAP oBmp FILENAME "SM_1.bmp"
DEFINE WINDOW oWnd TITLE "TTitle Class Test" MDI
ACTIVATE WINDOW oWnd;
ON INIT FOLDER() ;
ON PAINT PaintTransparent( hDC, oBmp )
oBmp:End()
return nil
function PaintTransparent( hDC, oBmp )
local nZEROCLR := nRGB( 255, 255, 255 ) // GetZeroZeroClr( hDC, oBmp:hBitmap )
local nOldColor := SetBkColor( hDC, nRGB( 255, 255, 255 ) )
TransBmp( oBmp:hBitmap, oBmp:nWidth, oBmp:nHeight,;
nZEROCLR, hDC, 10, 10, nBmpWidth( oBmp:hBitmap ), nBmpHeight( oBmp:hBitmap ) )
SetBkColor( hDC, nOldColor )
return nil
function Folder()
local oDlg, oFld1, oFld2
local cItem, oImage
DEFINE DIALOG oDlg RESOURCE "Test"
REDEFINE FOLDER oFld1 ID 110 OF oDlg ;
PROMPT "Folder1","Folder2" ;
DIALOGS "sub1", "sub2"
REDEFINE BITMAP oImage FILE "SM_1.BMP" OF oFld1:aDialogs[1] ID 600
oImage:lTransparent:=.t.
ACTIVATE DIALOG oDlg CENTERED
return nil
oWnd:oWndClient:GetDC()
... painting code using oWnd:oWndClient:hDC
oWnd:oWndClient:ReleaseDC()
#include 'fivewin.ch'
function Main()
local oWnd, oImage
DEFINE WINDOW oWnd
@ 10,10 BITMAP oImage FILE "SM_1.BMP" OF oWnd NOBORDER PIXEL
oImage:lTransparent:=.t.
ACTIVATE WINDOW oWnd
return nil
#include 'fivewin.ch'
function Main()
local oWnd
DEFINE WINDOW oWnd MDI
ACTIVATE WINDOW oWnd ON INIT WinChild()
return nil
function WinChild()
local oWnd, oImage
DEFINE WINDOW oWnd MDICHILD OF WndMain() COLOR CLR_BLACK,CLR_WHITE
@ 10,10 BITMAP oImage FILE "SM_1.BMP" OF oWnd NOBORDER PIXEL
oImage:lTransparent:=.t.
ACTIVATE WINDOW oWnd
return nil
if IsAppThemed() .and. Empty( ::oBrush:hBitmap ) .and. ! ::lTransparent
if IsAppThemed() .and. Empty( ::oBrush:hBitmap ) .and. ! ::lTransparent .or. ::oWnd:ClassName() == "TDIALOG"
if IsAppThemed() .and. Empty( ::oBrush:hBitmap ) .and. ::lTransparent
if ::oWnd:ClassName() == "TDIALOG"
DrawPBack( ::hWnd, ::hDC )
else
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oWnd:oBrush:hBrush )
endif
else
...
endif
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 31 guests