|
-
May 31st, 1999, 02:22 AM
#1
CEdit custom painting ?
Hi!
I'd like to use a customized CEdit-control which displays a gray text inside
if the control ist empty, otherwise the
user input (I've seen that in a commercial software but can't remember the
name). I tried to overwrite the OnPaint
but got not the result I wanted. Has anybody done this before?
Ciao,
Alex
-
May 31st, 1999, 04:06 AM
#2
Re: CEdit custom painting ?
Hi,
you have to create a message handler for the message ON_WM_CTLCOLORREFLECT and then you can set the text and back color like this:
HBRUSH CMyEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
pDC->SetTextColor(textcol);
pDC->SetBkColor(backcol);
return brush; // brush is a CBrush object, created with CreateSolidBrush(backcol)
}
Greetings, Jörg
-
May 31st, 1999, 04:13 AM
#3
Re: CEdit custom painting ?
Sorry, we misunderstood. The problem is not setting the colors (it works great the way you described), but doing custom painting (not only changing some colors) inside the CEdit (here: drawing some static, gayed text when the control ist "empty").
Thank you for your reply and I hope it's now more clearly what I want to do.
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
|