By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,325 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,325 IT Pros & Developers. It's quick & easy.

Custom Control Issue: endless WM_PAINT

P: n/a
Hello All,

I am currently working on an issue that has a custom control that mimics a
combobox that when it has focus it continues to generate endless WM_PAINT
Messages. The control in itself is primarily a windows panel with three
controls added ( textbox, combo box, and picturebox). In looking at the
code for the custom control I see no issue with it.

Any pointers on how to determine which likely control in this custom control
is sending out the WM_PAINT messages?

Thank you in advance
Eric
May 17 '07 #1
Share this Question
Share on Google+
2 Replies

P: n/a
On Thu, 17 May 2007 06:49:06 -0700, Eric <Er**@discussions.microsoft.com>
wrote:
[...]
Any pointers on how to determine which likely control in this custom
control is sending out the WM_PAINT messages?
If you literally get endless WM_PAINT messages and you never get a stack
overflow error, then it is actually more likely that a control is
invalidating when it redraws (a big no-no). So you should be looking for
a call to Invalidate(), rather than something like Refresh() or explicitly
sending WM_PAINT messages.

Note that changing values within a control also can cause the control to
be invalidated. Basically, the only thing that should happen in the Paint
event is to actually draw things. Nothing that affects the visual
appearance of a control should be called.

As for how to track down a specific problem control, I guess it depends on
what sort of access you have to the implementation of the control. But as
a first step, it seems like you could just use the process of
elimination. Remove one control at a time and when the problem goes away,
the last control you removed was the trouble-maker.

Pete
May 17 '07 #2

P: n/a
Thank you Peter,

Those pointers should assist me in determining which control is the problem.

Eric

"Peter Duniho" wrote:
On Thu, 17 May 2007 06:49:06 -0700, Eric <Er**@discussions.microsoft.com>
wrote:
[...]
Any pointers on how to determine which likely control in this custom
control is sending out the WM_PAINT messages?

If you literally get endless WM_PAINT messages and you never get a stack
overflow error, then it is actually more likely that a control is
invalidating when it redraws (a big no-no). So you should be looking for
a call to Invalidate(), rather than something like Refresh() or explicitly
sending WM_PAINT messages.

Note that changing values within a control also can cause the control to
be invalidated. Basically, the only thing that should happen in the Paint
event is to actually draw things. Nothing that affects the visual
appearance of a control should be called.

As for how to track down a specific problem control, I guess it depends on
what sort of access you have to the implementation of the control. But as
a first step, it seems like you could just use the process of
elimination. Remove one control at a time and when the problem goes away,
the last control you removed was the trouble-maker.

Pete
May 17 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.