|
-
May 12th, 1999, 01:34 PM
#1
changing text color
How do I change the text color on my document. Below is my code for getting my selected color from the CColorDialog box which I have implemented in my application. I just don't know what to do with the data I have received.
Any and all comments welcome!!!
void CPropPage1::OnFont()
{
// get value from the register
int SelectedColor = AfxGetApp()->GetProfileInt("Page1", "Color", 0);
// create a dialog color box
CColorDialog *pColor;
// set the default color to the value retrieved from the registry
pColor = new CColorDialog(SelectedColor);
if (pColor->DoModal() == IDOK)
{
// save the color selected
SelectedColor = pColor->GetColor();
}
// save this value to the registry for later use
AfxGetApp()->WriteProfileInt("Page1", "Color", SelectedColor);
}
-
May 15th, 1999, 03:22 AM
#2
Re: changing text color
It depends on how you're rendering the text. The document normally just holds the information you want to display, with a series of views implementing the display.
In a lot of cases the view is a normal window and all display is carried out through a handler of the WM_PAINT message (namely OnPaint). If you are using this and you have a command to write the text (e.g. TextOut) you need to call SetTextColor before hand on the Device context available within the paint handler.
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
|