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.
Code: Select all
// 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
uwe