Graphics Performance Issue

J

JMecc0

I am drawing simple graphics on a custom control which has a static
background image. When I try to rapidly (maybe 50 times per second)
redraw the graphics the computer can't keep up. There is no issue
when I just draw graphics on a control with a plain color as the
background but with an image set as the background it seems the
control redraws the background each time I refresh which makes its
performance poor. Is there a way to improve this situation?

Thanks,
Jo
 
R

rowe_newsgroups

I am drawing simple graphics on a custom control which has a static
background image.  When I try to rapidly (maybe 50 times per second)
redraw the graphics the computer can't keep up.  There is no issue
when I just draw graphics on a control with a plain color as the
background but with an image set as the background it seems the
control redraws the background each time I refresh which makes its
performance poor.  Is there a way to improve this situation?

Thanks,
Jo

I'm not sure what all you're drawing, but I believe you can just set
the invalidation region on the control to only invalidate where you
are drawing. This would be helpful if you are only using one small
area of the control, but wouldn't do much if you were drawing over the
entire control.

One other thing that may or may not help (I'm a web developer so I've
been away from GDI+ for a while) is to use the graphics object to draw
the background as well. It could be that if it's all being done in one
place, you might have less parts spawning a redraw.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
J

JMecc0

Thanks Seth.

I tried redrawing with the graphics object rather than the built-in
BackgroundImage property but that doesn't seem to really help. The
invalidate strategy might - I'm trying to figure out how to properly
use this. I'm making a dial gauge control, such that the measured
values show up as a needle moving around like in a physical pressure
gauge. The redraw is fine when I use the graphics object to draw the
gauge & needle but I figured it would be nice to have a static
background photoshopped version of a gauge with a needle that is
continually redrawn in front of it as new values come in. To do the
invalidation, would I just keep a minimum bounding rectangle around my
needle and invalidate that region only and then redraw the needle
somewhere else on the gauge area?

Thanks,
Jo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top