.NETGURU
Can I have two message pumps in the same form?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.performance.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

inma (VIP)
I have one chart in a form and some buttons. The chart shows a huge number of
points and the redrawing takes about 2 seconds. The problem is that while the
chart is redrawing the form gets frozen.

The problem comes from the fact that there is only one message pump in the
form and the processing time of the refresh chart message takes 2 seconds.
During that time the pump is not attending messages from other controls.

How can I solve the problem?. Can I have two message pumps in the same form?

Thanks in advance
Inma
Reply to this message...
 
    
AlexS
inma,

your problem is not as much related to message pump as to non-optimal
drawing code. Since Windows 1.0 it was always a pain in "brain" to make
Paint sufficiently quick for complex graphics.
Before going for "heavy-duty" solutions like another message pump, I would
profile painting code and optimized it. You might be surprised with results.
Start with checking if you really need to repaint whole graph, Maybe
scrolling dc or redrawing only portion of graph will do the magic?

Btw, you will never have another message pump on same thread in foreseeable
future. It's too non-Windows.

HTH
Alex

"inma" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> I have one chart in a form and some buttons. The chart shows a huge number
of
> points and the redrawing takes about 2 seconds. The problem is that while
the
[Original message clipped]

Reply to this message...
 
    
inma (VIP)
Thanks for your answer AlexS but my problem is not the time it takes the
chart to refresh. I don't care even if it takes 1 minute. My problem is that
during that period of time the entire form is not responsive.
Anyway I can't optimize the chart because It is a closed code one.

Regards
Inma

"AlexS" wrote:

[Original message clipped]

Reply to this message...
 
    
Niall
Can you have the chart render to an image in a separate thread, instead of
directly to the GUI? Then you can push the image onto the form...

Niall

"inma" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
inma (VIP)
I have to recognize that it is an interesting approach but It has an
important disadvantage. If you deal with an image you loose the chart
interaction capabilities. For example, zooming, rotating or showing labels as
the mouse icon moves over the chart. Also if you click in the chart, throws
an event that gives you information about whereabout in the chart you clicked
(not only x-y coords).

As you pointed out , I think the solution is in multithreading but I
really don't know how to run the drawing code in a diferent thread.

Many thanks for your answer Niall
Inma

"Niall" wrote:

[Original message clipped]

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification