call standard-draw of a control
-
Hello everybody, I like to draw a small border inside my CEdit. To "highlight" it. I use already OnEraseBgnd to fill the entire CEdit in another color. But in OnEraseBgnd I can't draw a small border, because the entire Background will be redrawn. If I handle OnPaint(), it works, but in this case, I need to redraw the entire control myself (text, background, etc ...) Is there a function-call to draw the standard-appearance, and after it, I start to draw myself on it? I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work. Big thanks for any idea or basic instruction :) Greetings
-
Hello everybody, I like to draw a small border inside my CEdit. To "highlight" it. I use already OnEraseBgnd to fill the entire CEdit in another color. But in OnEraseBgnd I can't draw a small border, because the entire Background will be redrawn. If I handle OnPaint(), it works, but in this case, I need to redraw the entire control myself (text, background, etc ...) Is there a function-call to draw the standard-appearance, and after it, I start to draw myself on it? I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work. Big thanks for any idea or basic instruction :) Greetings
baerten wrote:
I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work.
-elaborate this a bit, please.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers are evil, EVIL i tell you!! <
-
baerten wrote:
I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work.
-elaborate this a bit, please.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers are evil, EVIL i tell you!! <
Thanks for your post. OnPaint is called in my control to paint/draw on the control. If I don't handle the WM_PAINT Message, the initial Drawing-Functions are called and the control is correctly drawn. If I handle this Message, the control is blank, no drawings on it. I need to draw all myself. I want to call a function into OnPaint to draw the initial/standard drawings (Background, Text, ...) and after this, I make some small paintings on it. Because I don't want to draw the entire CEdit by myself to simply draw 4 lines on it (an extra border in red) I hope I could explain it better Thanks :)
-
Thanks for your post. OnPaint is called in my control to paint/draw on the control. If I don't handle the WM_PAINT Message, the initial Drawing-Functions are called and the control is correctly drawn. If I handle this Message, the control is blank, no drawings on it. I need to draw all myself. I want to call a function into OnPaint to draw the initial/standard drawings (Background, Text, ...) and after this, I make some small paintings on it. Because I don't want to draw the entire CEdit by myself to simply draw 4 lines on it (an extra border in red) I hope I could explain it better Thanks :)
I'm not sure i completely understand but why don't you just let OnPaint do it's job and afterwards draw your border? E.g. like this:
CMyGreatEdit::OnPaint()
{
__super::OnPaint(); //Let the base do the complete drawing of the control
CDC *dc = GetDC();
//draw your border wherever you need to using the dc...
ReleaseDC(dc);
}> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers are evil, EVIL i tell you!! <