When you want to draw something on a form you need a Graphics object.
But a Graphics constructor isn’t public and if that is not enough the Graphics class is also sealed! This means you can’t create a Graphics object via the new keyword nor can you derive from the Graphics class. One way to get a Graphics object is through a Paint event handler of a Form via the PaintEventArgs class.
OK now you can use an array of Points, pass it with a Pen object to DrawLines and it draws your function!
This is not what I want here. I want my functions to plot a single dot, not connected by a line. That seems hard to do in GDI+, if anyone knows a better answer then what I got here please let me know. The PlotPixel method of my Plot class is something I found on the internet, which I feed with transformed pixelcoordinates so it looks nice on the screen.
I exercice my Plot class in a DrawIt class which is derived from Form. In the DrawWindow_Paint event handler two functions are plotted: a classic sine function and a function which simulates the trajectories of particles in a cyclotron. Change some of the values a,b,c,x and y to get amazing results!
Also notice the same minimalistic approach as used in a previous entry in code snippets.