Smooth and Fast 2D graphics in .Net

foozball3000

Executive Member
Joined
Oct 28, 2008
Messages
5,929
Reaction score
1,738
Location
Kyalami
I'm busy developing a small game for students as a Windows App. (If there's time I'll quickly redo it in a web app.) As its a game, it needs graphics.
I'm guessing that loading images into the windows Forms backgrounds is the wrong way of going about this.

Can someone please point me in the right direction?
 
Disclaimer: I don't know Drug Wars.

If you want to do something with decent graphics, i'd recommend WPF over winforms if XNA doesn't suit you. You can style things in ways you cannot with winforms (using resource dictionaries), and make use of the built in animation classes. In terms of application speed, with WPF you have two choices:

1. Using Shapes and higher lever objects will make development easy, but slow when you want to add a lot of shapes to the screen. They inherit from System.Windows.FrameworkElement, and as such contain a lot of baggage that you can do without if you want faster graphics.

2. Using the DrawingContext of a canvas to draw the shapes directly onto it (also look at StreamGeometry). You will have to use VisualHitTesting to handle mouse interation (not that difficult), but rendering is far far quicker when handling lots of objects on the screen. This option will take longer to get to grips with, but the application performance will be an order of magnitude better.

Have you got any experience with WPF?
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X