Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

painting over child controls

0 views
Skip to first unread message

Florin Braghis

unread,
Mar 4, 2003, 5:56:46 AM3/4/03
to
Hi
I'm trying to do some painting over a control (say, BitBlt()-ing over a
combo-box). I can't, however, find the right moment to do this.
If i paint when WM_PAINT arrives, the control gets repainted afterwards and
it spoils everything.
I think I should do this *after* the control has repainted itself, but how
do I find out when this happened ?

And another question - is there a way to apply a logical operation for
FillRect() (or other function, so that the filled color blends with the
background, like BitBlt()-ing with SRCAND)?

F


--------------------
Time is nature's way of keeping everything from happening at once.
(unknown)

Jeff Partch

unread,
Mar 4, 2003, 9:32:24 AM3/4/03
to
"Florin Braghis" <xsf...@softhome.net> wrote in message
news:ulJkJzj4...@TK2MSFTNGP09.phx.gbl...

> Hi
> I'm trying to do some painting over a control (say, BitBlt()-ing over
a
> combo-box). I can't, however, find the right moment to do this.
> If i paint when WM_PAINT arrives, the control gets repainted
afterwards and
> it spoils everything.
> I think I should do this *after* the control has repainted itself, but
how
> do I find out when this happened ?

The real problem that I've found with WM_PAINT is that most if not all
of the standard controls will do at least some of their painting
directly and leave you out of the loop, but otherwise it shouldn't be a
problem to subclass the control and respond to WM_PAINT by calling
BeginPaint, passing the original WindowProc the WM_PAINT message with
the HDC in WPARAM, and then doing your painting. Remember though that a
combobox can be a combination of several controls each doing their own
painting. Another trick you can try is handling the WM_CTLCOLORxxx
notification from the control by doing a PostMessage of a custom message
to yourself, and after-painting in response to that custom message. The
benefit of the WM_CTLCOLOR notification is that a control will always
send it before it does any painting. Remember though that a combobox
both sends and receives WM_CTLCOLOR notifications. YMMV.
--
Jeff Partch [VC++ MVP]


vipin

unread,
Mar 4, 2003, 2:30:57 PM3/4/03
to
your best bet is subclass the combobox when the
WM_INITDIALOG comes for the dialogbox and then
you will get all the messages to work on in your
windowproc.
vipin
>.
>
0 new messages