|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GDI+ or Direct3DHello,
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. 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. -- Show quoteBob 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. "wansch" <wan***@discussions.microsoft.com> wrote in message news:6BD1D08E-F28B-4039-8A45-F3F1E2CD89A3@microsoft.com... > 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. Thanks, I try this.
Show quote "Bob Powell [MVP]" wrote: > 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. > > > > > > "wansch" <wan***@discussions.microsoft.com> wrote in message > news:6BD1D08E-F28B-4039-8A45-F3F1E2CD89A3@microsoft.com... > > 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. > > > |
|||||||||||||||||||||||