Mega Code Archive

 
Categories / C# Tutorial / WPF
 

Sine Wave

using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Shapes;     public class SineWave : Window     {         [STAThread]         public static void Main()         {             Application app = new Application();             app.Run(new SineWave());         }         public SineWave()         {             Polyline poly = new Polyline();             poly.VerticalAlignment = VerticalAlignment.Center;             poly.Stroke = SystemColors.WindowTextBrush;             poly.StrokeThickness = 2;             Content = poly;             for (int i = 0; i < 2000; i++){                 poly.Points.Add(new Point(i, 96 * (1 - Math.Sin(i * Math.PI / 192))));             }             }     }