How to fill a BMP from Res. with a spec. Color => SOURCE
Posted: Wed Mar 26, 2008 1:00 am
Hello,
The source
how to show a bitmap with different backgrounds
from resource ( using the same bitmap ) :
----------------------------------------------------------
2 Bitmaps has to be shown with different colors
Bitmap 1 ( same resource )
---------------------------------
REDEFINE BITMAP oBmp1 ID 770 ADJUST RESOURCE "Blanc" OF oDlg5
hDC := oBmp1:GetDC()
oBmp1:bPainted := { |hDC|OnPaint( hDC,oBMP1,nCOLOR1) }
oBmp1:ReleaseDC()
Bitmap 2 ( same resource )
---------------------------------
REDEFINE BITMAP oBmp2 ID 771 ADJUST RESOURCE "Blanc" OF oDlg5
hDC := oBmp2:GetDC()
oBmp2:bPainted := { |hDC|OnPaint( hDC,oBMP2,nCOLOR2) }
oBmp2:ReleaseDC()
//----------------------------------------------------------------//
FUNCTION ONPAINT(hDC,oBmp,nBkColor)
SetBkMode( hDC, 0 ) // 1 = Transparent
oBmp:oBrush := TBrush():New( , nBkColor )
FillRect( hDC, GetClientRect( oBmp:hWnd ), oBmp:oBrush:hBrush )
RETURN NIL
This works perfect.
It will be in the Designer-Update 1.8
Regards
Uwe
The source
how to show a bitmap with different backgrounds
from resource ( using the same bitmap ) :
----------------------------------------------------------
2 Bitmaps has to be shown with different colors
Bitmap 1 ( same resource )
---------------------------------
REDEFINE BITMAP oBmp1 ID 770 ADJUST RESOURCE "Blanc" OF oDlg5
hDC := oBmp1:GetDC()
oBmp1:bPainted := { |hDC|OnPaint( hDC,oBMP1,nCOLOR1) }
oBmp1:ReleaseDC()
Bitmap 2 ( same resource )
---------------------------------
REDEFINE BITMAP oBmp2 ID 771 ADJUST RESOURCE "Blanc" OF oDlg5
hDC := oBmp2:GetDC()
oBmp2:bPainted := { |hDC|OnPaint( hDC,oBMP2,nCOLOR2) }
oBmp2:ReleaseDC()
//----------------------------------------------------------------//
FUNCTION ONPAINT(hDC,oBmp,nBkColor)
SetBkMode( hDC, 0 ) // 1 = Transparent
oBmp:oBrush := TBrush():New( , nBkColor )
FillRect( hDC, GetClientRect( oBmp:hWnd ), oBmp:oBrush:hBrush )
RETURN NIL
This works perfect.
It will be in the Designer-Update 1.8
Regards
Uwe