.
In Depth Banner
Skip Navigation Links

Select your preferred language

The Spiral drawing case handler

        case TransitionTypes.Spiral:

          if(_currentPercentage<100)

          {

            double percentageAngle =  _nHDivs*(Math.PI*2)/100;

            double percentageDistance = Math.Max(Width,Height)/100;

 

            pth=new GraphicsPath(FillMode.Winding);

            float cx=Width/2;

            float cy=Height/2;

 

            double pc1=_currentPercentage-100;

            double pc2=_currentPercentage;

            if(pc1<0)

              pc1=0;

            double a=percentageAngle*pc2;

 

            PointF last=new PointF((float)(cx+(pc1*percentageDistance*Math.Cos(a))),(float)(cy+(pc1*percentageDistance*Math.Sin(a))));

            for(a=percentageAngle*pc1;pc1<=pc2;pc1+=0.1,a+=percentageAngle/10)

            {

              PointF thisPoint = new PointF((float)(cx+(pc1*percentageDistance*Math.Cos(a))),(float)(cy+(pc1*percentageDistance*Math.Sin(a))));    

              pth.AddLine(last,thisPoint);

              last = thisPoint;

            }

            pth.CloseFigure();

 

            e.Graphics.SetClip(pth,CombineMode.Replace);

            pth.Dispose();

          }

          e.Graphics.DrawImage(_imageB,ClientRectangle,0,0,_imageB.Width,_imageB.Height,GraphicsUnit.Pixel);

 

          break;

 

 

Return to the article.

Copyright © Bob Powell 2000-.  All rights reserved.