talsp
asked on
transparent static text on bitmap background problem
hi,
on the function OnCtlColor
i am doing the following in order to draw background bitmap.
{
HBRUSH hbr;
hbr=CDialog::OnCtlColor(pD C,pWnd,nCt lColor);
static HBRUSH hBrush=NULL;
if(nCtlColor == CTLCOLOR_DLG)
{
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BACK );
if(!hBrush)
hBrush=CreatePatternBrushb itmap);
hbr=hBrush;
}
return hbr;
}
i want to show the static text i got on this dialog with the transparent style but what i get is the gray background.
i checked the transparent box in the properties.
some1 maybe got a solution?
thanks.
on the function OnCtlColor
i am doing the following in order to draw background bitmap.
{
HBRUSH hbr;
hbr=CDialog::OnCtlColor(pD
static HBRUSH hBrush=NULL;
if(nCtlColor == CTLCOLOR_DLG)
{
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BACK
if(!hBrush)
hBrush=CreatePatternBrushb
hbr=hBrush;
}
return hbr;
}
i want to show the static text i got on this dialog with the transparent style but what i get is the gray background.
i checked the transparent box in the properties.
some1 maybe got a solution?
thanks.
Derive a class from CStatic
handle WM_ERASEBACKGROUND. In thie OnEraseBackground function draw the bitmap u want.
If u want to draw the image of the dialog, just set that bitmap to this class. This class wants to keep a memory dc of this bitmap, and draw it on OnErasebackground.
There is no need to draw the static text on the control. That all will done by the parent class
GOOD LUCK
handle WM_ERASEBACKGROUND. In thie OnEraseBackground function draw the bitmap u want.
If u want to draw the image of the dialog, just set that bitmap to this class. This class wants to keep a memory dc of this bitmap, and draw it on OnErasebackground.
There is no need to draw the static text on the control. That all will done by the parent class
GOOD LUCK
ASKER
thank you both for your answers but i still can't get it.
DanRollins: i did what u said but now only the checkboxes i am using have transparent labels but all the edit boxes and static text controls still with gray background
(btw the transparent background the checkboxes has now is not "smooth" with the background)
roshmon: i am trying to understand your point, the problem i got is that the static text i am using are created by the resource editor and not dynamically.
i am also having problem to understand it correctly i think.
thanks both an di hope u can help me more.
DanRollins: i did what u said but now only the checkboxes i am using have transparent labels but all the edit boxes and static text controls still with gray background
(btw the transparent background the checkboxes has now is not "smooth" with the background)
roshmon: i am trying to understand your point, the problem i got is that the static text i am using are created by the resource editor and not dynamically.
i am also having problem to understand it correctly i think.
thanks both an di hope u can help me more.
best way is open the bitmap in paintbrush and edit it.
then save it
it'll work
Shay
then save it
it'll work
Shay
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks man,
i really appreciate your help.
the last comment of yours solve the prob.
byebye
i really appreciate your help.
the last comment of yours solve the prob.
byebye
If you want to modify the background color for the static control itself, you must change your IF statement so that CTLCOLOR_STATIC is also handled.
You may also need to handle OnEraseBkgnd().
-- Dan