GDI+ or Direct3D

G

Guest

Hello,
I try to write a small controll, where you can move around other controls on
a panel with the mouse. The controls can be connected by lines wich are drawn
on the panel surface. I have solved this with overriding MouseDown and
MouseMove events of the panel.
So drawing is done during the MouseMove event, when there about 10 controls
connected by lines on the panel, the performance is very bad. I tried
different invalidation concepts but none realy was good. When I invalidate
the hole panel (region) all lines are redrawn, wich is ok when there are many
lines. But moving a single control and line, this concept is bad. When I
invalidate only those line areas wich move the performance is ok when I move
one control and line, but it suffers performance when I move many lines.
My question is?
Is it good idea to solve moving graphics at runtime with gdi+ or is it
better to use Direct3D. Or is there a common pattern to solve such problems?

Thanks for help.
 
B

Bob Powell [MVP]

If you're using actual Control based objects for the movable items on your
drawing canvas I suggest that you start over and create a simple retained
mode graphics system that draws objects directly to the screen without
messing about with a plethora of controls.

The GDI+ FAQ has an article on retained mode graphics systems and there are
other commercial systems available too that you might wish to try such as
VG.NET.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
G

Guest

Thanks, I try this.

Bob Powell said:
If you're using actual Control based objects for the movable items on your
drawing canvas I suggest that you start over and create a simple retained
mode graphics system that draws objects directly to the screen without
messing about with a plethora of controls.

The GDI+ FAQ has an article on retained mode graphics systems and there are
other commercial systems available too that you might wish to try such as
VG.NET.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

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

Top