Autometaii.SineWave.RunOnce C# (CSharp) Method

RunOnce() public method

public RunOnce ( GDIRenderer aPort ) : void
aPort GDIRenderer
return void
        public void RunOnce(GDIRenderer aPort)
        {
            int i;
            int cxClient = fSize.Width;
            int cyClient = fSize.Height;
            Point[] points = new Point[fNumSegments];

            aPort.SaveState();

            GDIPen redPen = new GDIPen(RGBColor.Red);
            aPort.DrawLine(redPen, new Point(0, cyClient/2), new Point(cxClient, cyClient / 2));

            GDIPen blackPen = new GDIPen(RGBColor.Black);
            for (i = 0; i < fNumSegments; i++)
            {
                points[i].X = i * cxClient / fNumSegments;
                points[i].Y = (int)(((double)cyClient/2.0f)*(1.0f-Math.Sin(Math.PI*2.0f*(double)i/(double)fNumSegments)));
            }

            aPort.DrawLines(blackPen, points);


            aPort.ResetState();
        }
    }

Same methods

SineWave::RunOnce ( IDraw2D aPort ) : void
SineWave::RunOnce ( IRenderGDI aPort ) : void