FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour refill a bitmap
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
refill a bitmap
Posted: Sun Jan 17, 2010 08:36 PM
If I have a bitmap showed on a dialog

sample



can I refill only the black arrow with a different color ( RED, BLU,YELLOW) ?

I wish that the arrow must be refilled by end user with the mouse

How I can make this ?
FWH .. BC582.. xharbour
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: refill a bitmap
Posted: Sun Jan 17, 2010 09:13 PM
It must be the same BMP ( size ) but with a red Arrow. A BMP for each color.
You can replace the BMP with the black Arrow with the one with the red Arrow.

// from File
// REDEFINE BITMAP oBmp1 ID 100 OF oDlg FILENAME Black.bmp"

// from resource
REDEFINE BITMAP oBMP1 ID 100 ADJUST RESOURCE "Black" OF oDlg
oBMP1:bPainted := {|hDC| ReplaceBMP ( oBMP1, newBMP1 ) }

A oBMP1:Refresh() will replace the BMP with newBMP1
( can be a Button-action or Mouse-focus )

// Replace BMP on MouseClick

REDEFINE BITMAP oBMP1 ID 100 ADJUST RESOURCE "Black" OF oDlg ;
ON CLICK ReplaceBMP ( oBMP1, "Red.bmp" )

// ------------ Replace ------------

FUNCTION ReplaceBMP( oBitmap, cBitmap)
Local oImage

DEFINE IMAGE oImage FILENAME cBitmap
aRect := GETCLIENTRECT( oBitmap:hWnd )

PalBmpDraw( oBitmap:GETDC(), 0, 0, oImage:hBitmap, , aRect[4], aRect[3] )
oBitmap:ReleaseDC()

RETURN( NIL )


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: refill a bitmap
Posted: Sun Jan 17, 2010 10:44 PM

sorry But I found the function FloodFill

I think it can be done calculating the coors the bitmaps

FloodFill(hCDC, x,y , CLR_BLACK, nColor)

but I not Know How Found the coors of the bitmap

FWH .. BC582.. xharbour

Continue the discussion