FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to fill a bitmap from resources with a solid color ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
How to fill a bitmap from resources with a solid color ?
Posted: Tue Mar 25, 2008 01:38 PM
Hello,

I want to fill a Bitmap from resource with a solid Color
I think, i have to do something like this
but something doesn't work
No errors, but there is no Color to see.
In 2 Bitmaps, i want to show the used 2 Basic-Colors
Foreground / Background how they look next to each other.



// nColor1 = Foreground
// nColor2 = Background

REDEFINE BITMAP oBmp1  ID 770 ADJUST RESOURCE "Blanc"  OF oDlg5
hDC := oBmp1:GetDC()
oBmp1:bPainted := { |hDC|OnPaint( hDC,cTEXT,nCOLOR1,oBFont) } 
oBmp1:ReleaseDC()

REDEFINE BITMAP oBmp2  ID 771 ADJUST RESOURCE "Blanc"  OF oDlg5
hDC := oBmp2:GetDC()
oBmp2:bPainted := { |hDC|OnPaint( hDC,cTEXT,nCOLOR2,oBFont) } 
oBmp2:ReleaseDC()


//----------------------------------------------------------------// 

FUNCTION ONPAINT(hDC,cMsg,nBkColor,oFont) 
LOCAL hOldFont 

hOldFont := SelectObject( hDC, oFont:hFont ) 
 // 1 = Transparent  I need solid Color => set to 0
 // -------------------------------------------------------
SetBkMode( hDC, 0 )   
SetTextColor( hDC,nBkColor)
TextOut( hDC, 10, 70, cMsg ) 
SelectObject( hDC, hOldFont ) 
SetBkColor( hDC,nBkColor )  ???  nothing to see

//  ??????    Top, Bottom, Right, Left ?????
// ----------  Maybe something like that ???---------------------------

//  FillRect( hDC, { 10, 10, 10, 10 }, nBkColor )   

RETURN NIL


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: 4043
Joined: Wed Dec 19, 2007 06:40 PM
2 Colors next to each other
Posted: Tue Mar 25, 2008 08:11 PM

In 2 Bitmaps i want to show 2 selected colors
how it looks, to use them in rows or cols of xbrowse
or other objects, where you need more than 1 color.

Regards

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: 312
Joined: Sat Oct 08, 2005 09:12 AM
How to fill a bitmap from resources with a solid color ?
Posted: Tue Mar 25, 2008 10:55 PM
Uwe,

maybe this coulds be an easier way to go.
Instead of bitmaps take the background of a say object:
#include "FiveWin.ch" 

////////////////
PROCEDURE Main() 
////////////////
LOCAL oDlg
LOCAL oSay1, oSay2
LOCAL cVar := " "



   DEFINE DIALOG oDlg NAME "DLG_1"

   REDEFINE SAY oSay1 ID 10 PROMPT cVar OF oDlg COLORS CLR_BLACK, nRGB(  255,   0,   0 )
   REDEFINE SAY oSay2 ID 20 PROMPT cVar OF oDlg COLORS CLR_BLACK, nRGB(    0, 255,   0 )
   REDEFINE SAY oSay2 ID 30 PROMPT cVar OF oDlg COLORS CLR_BLACK, nRGB(    0,   0, 255 )

   ACTIVATE DIALOG oDlg CENTERED 

RETURN

Regards,
Detlef
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Change Backgrounds of Bitmaps
Posted: Tue Mar 25, 2008 11:45 PM

Hello Detlef,

At first i wanted to use says, but i want to give the users
a source with the source-creator, to use this as background
for xBrowse or other objects, as bitmap.
The easy way is, to use a infobar-object with one color.
But i try, to make the tool useful for FW-users
( without Via-Coral ) as well.
Get the TFont- source of a selected font. The color-values
und more. The basic-structure for windows and dialogs.
It is still more possible.

Thank you for the reply.

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.

Continue the discussion