Anyone as old as I played with Spirograph at one time in their lives. For anyone not familiar, Spirograph was a design tool that allowed you to create intricate spiral patterns by rolling wheels around the inside of larger rings. A pen was stuck in a hole in the smaller wheel to draw. By varying the size of the wheel and the location of the pen, very complex patterns could be produced.
Spiro designer is a partial implementation of Spirograph. Spiro Designer uses the Matrix and GraphicsPath classes with their Transform and Rotate methods to build a spiro. An example is shown below:

All the graphics work is done in the constructor for the Spiro object:
In this example we saw the use of Forms Authentication to identify a user and storing personalized settings for the identified users of the system. This logic can be extended to provide a user portal where the user can save his settings for stock quotes, weather, news etc. You can use this technique for personalization and expand on it to improve the mobile users experience at your site in ASP.Net Web Applications and Mobile Web Applications. Personalization gives the user a feeling of familiarity and also avoids repetitive data entry.
public
Spiro(SpiroPoint _center, int _radouter, int _radinner, int _offset,int startangle, Color c, float width, int ndex)
{
center = _center;
pen = new SpiroPen(c, width);
radouter = _radouter;
radinner = _radinner;
offset = _offset;
angle = startangle;
index = ndex;
pts = new PointF[361];
types = new byte[361];
int radratio = radouter/radinner;
Point innercenterpoint = new Point(center.Point.X+radouter-radinner,center.Point.Y);
Point inneroffset = new Point(innercenterpoint.X+offset,center.Point.Y);
GraphicsPath gpOrigOuter = new GraphicsPath();
GraphicsPath gpOrigInner = new GraphicsPath();
gpOrigOuter.AddLine(center.Point,innercenterpoint);
gpOrigInner.AddLine(innercenterpoint, inneroffset);
Matrix outertrans = new Matrix(1, 0, 0, 1, 0, 0);
Matrix innertrans = new Matrix(1, 0, 0, 1, 0, 0);
GraphicsPath outer = new GraphicsPath(); outer = (GraphicsPath)gpOrigOuter.Clone();
GraphicsPath inner = new GraphicsPath();
inner = (GraphicsPath)gpOrigInner.Clone();
for(int n=0; n<361; n++)
{
outertrans.RotateAt(n, center.Point);
outer.Transform(outertrans);
Point newinneroffset = new Point((int)outer.GetLastPoint().X+offset,(int)outer.GetLastPoint().Y);
inner.AddLine(outer.GetLastPoint(),newinneroffset);
innertrans.RotateAt(n*(1-radratio), outer.GetLastPoint());
inner.Transform(innertrans);
pts[n] = inner.GetLastPoint();
types[n] = (byte)PathPointType.Line;
outertrans.Dispose();
outertrans = new Matrix(1, 0, 0, 1, 0, 0);
innertrans.Dispose();
innertrans = new Matrix(1, 0, 0, 1, 0, 0);
outer = (GraphicsPath)gpOrigOuter.Clone();
inner = (GraphicsPath)gpOrigInner.Clone();
}
gp = new GraphicsPath(pts, types);
if(startangle != 0)
{
Matrix finaltrans = new Matrix(1, 0, 0, 1, 0, 0);
finaltrans.RotateAt(startangle, center.Point);
gp.Transform(finaltrans);
}
}

Join the conversation! Your thoughts help the community grow.