|
-
July 29th, 1999, 10:57 AM
#1
Text/background color
Hi,
My control outputs text in a window.
If I change the backgroundcolor to, say, black,
and the textcolor to green, then the letters are
still on a white background.
Although the background without text is black.
How can I get green letters on a completely black background ?
Thanks,
PUH
-
July 29th, 1999, 12:04 PM
#2
Re: Text/background color
In the MSDN documentation :
The background color for a character is specified by the SetBkColor and SetBkMode member functions of the CDC class.
This help ?
Roger Allen
Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
Please remember to rate useful answers. It lets us know when a question has been answered.
-
July 30th, 1999, 03:23 AM
#3
Re: Text/background color
Hi,
you have to make the control transparent . If you are using an Edit control you have to implement the
OnCtlColor() function.
ccode
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
switch(nCtlColor)
{
case CTLCOLOR_EDIT:
{
pDC->SetBkMode(TRANSPARENT);
return myNewBrush;
}
}
return myOldBrush;
}
//where myNewBrush is a brush made with your desired color
//and myOldBrush is a grey one.
/ccode
-
August 3rd, 1999, 02:46 PM
#4
Re: Text/background color
in *.cpp not *Dlg.cpp put SetDialogBkColor...
-------------------------------------------------
BOOL COcdApp::InitInstance()
{
AfxEnableControlContainer();
//*************THIS**************************
SetDialogBkColor(RGB(0, 0, 0), RGB(0, 0, 255));
//*******************************************
// Standard initialization
// If you are not using these features and wi...
-
August 3rd, 1999, 03:03 PM
#5
Re: Text/background color
No, Roger, not enough 
Well, I put static text. Colored (green fonts on black). For background, I load bitmap picture on way: ClassWizard->InsertActiveX Control..->choose Microsoft Forms 2.0 Image -> this creates frame, then go to properties->All->choose picture and in right cell click mice->find the *.bmp picture in directory ... and this is it. Stuffs works great.
(Thanx M$).
And now, how to make my static text transparent, without black background?
I find some "tetris" whatever example, some hints (which are far away from "hinting" me...) So, who would be so kind, and dummy me tell how to make this letters transparent, without background?
Thanx.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|