I'm looking for a way to display points on a 2D plane in a C# Winforms project.
The po开发者_Python百科ints will be updated 5 times per second. If a given point changes (number of points is always static) it would be nice to animate them to their new location.
I tried Zendgraph but it is more focused on charts.
How do I visually plot and animate Cartesian points in C#?
Have a look at this code I've just written, for a working and simple example:
http://pastebin.com/Xs9DeJ8m
Usage:
- add this class to your project (change namespace to yours if you will)
- rebuild the solution
- now you should be able to see
Plot
control among the designer toolbox items
for basic 2D drawing there is good old GDI+ which you can find in the System.Drawing namespace
You will basically create a bitmap, and using the various methods of the System.Drawign.Graphics class, draw shapes/colors/etc onto it, then place it on your form in either an PictureBox control or even as the form Background.
I don't know neither your knowledge nor the technical requirements of your application, but you may consider to create your animated drawing in a WPF user control, and use the ElementHost control to embed the WPF control to your winform application.
Then you will benefits the animating features of WPF, in your WPF application.
If you know WPF, it can be a bit easier than animating yourself the plots.
精彩评论