473,473 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Custom Control Issue: endless WM_PAINT

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
2 2687
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Matt Fielder | last post by:
I have developed a custom control to be used in my application. My application includes a form designer, so the control can be hosted while designmode for the control is either true or false,...
2
by: SpotNet | last post by:
Hi Newsgroup, I've been creating (almost done) Common Dialog class libraries (under one name space) with highly customisable common dialogs. With my ColorDialog I am able to completely hide...
1
by: Jim Margarit | last post by:
I have create a Panel subclass that I can resize at runtime. I want to draw resizing handles that accurately track the panel frame. So far I have tried drawing them in the wm_sizing handler, the...
4
by: CroDude | last post by:
I've made a custom groupbox control. Inside, as one of it's members is CSimpleGradient object. CSimpleGradient is a wrapper class for gradient usage. Basically it looks like that: public class...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
8
by: Lee | last post by:
Hi all, I'm trying to programatically change the background color of lines of text and running into a few difficulties, anyone got any suggestions? my relevant code is as follows: public void...
1
by: rn5a | last post by:
I have created a custom control button which when clicked displays a message in the JavaScript alert dialog. I could successfully compile the VB class file into a DLL & also could add it to the...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
2
by: RSH | last post by:
Is it possible to override the onPaint event of the RichTextBox control to set the smoothing mode to anti-aliased? If so how do I do it? I havent been able to find anything about doing this on...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.