How to fill a bitmap from resources with a solid color ?

How to fill a bitmap from resources with a solid color ?

Postby ukoenig » Tue Mar 25, 2008 1: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.

Image

Code: Select all  Expand view  RUN

// 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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

2 Colors next to each other

Postby ukoenig » Tue Mar 25, 2008 8: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Detlef Hoefner » 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:
Code: Select all  Expand view  RUN
#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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Change Backgrounds of Bitmaps

Postby ukoenig » 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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], wilsongamboa and 86 guests