<%@ Page Language="c#" ContentType="image/gif" Debug="true" %> <%@ Import Namespace="System.Drawing" %> <%@ Import Namespace="System.Drawing.Imaging" %> <%@ Import Namespace="System.Drawing.Drawing2D" %> <% int iHeight = int.Parse(Request.QueryString.GetValues("PieSize").GetValue(0).ToString()); int iWidth = iHeight; string text = Request.QueryString.GetValues("Text").GetValue(0).ToString(); if (text == "Ar") { text = "Årsmodell"; } if (text == "Farg") { text = "Färg"; } string ferg = ""; Response.Clear(); Bitmap bmp = new Bitmap(iWidth, iHeight, PixelFormat.Format24bppRgb); Graphics g = Graphics.FromImage(bmp); /* g.Clear(Color.LightYellow); */ g.Clear(Color.White); try { float fStart = 0; int iCount = Request.QueryString.GetValues("angle").Length; for (int i = 0; i < iCount; i++) { Brush b; b = new SolidBrush(Color.Fuchsia); ferg = Request.QueryString.GetValues("fargkod").GetValue(i).ToString(); if (ferg == "Yellow") { b = new SolidBrush(Color.Yellow); } if (ferg == "Red") { b = new SolidBrush(Color.Red); } if (ferg == "Blue") { b = new SolidBrush(Color.Blue); } if (ferg == "Silver") { b = new SolidBrush(Color.Silver); } if (ferg == "Green") { b = new SolidBrush(Color.Green); } if (ferg == "Orange") { b = new SolidBrush(Color.Orange); } if (ferg == "Black") { b = new SolidBrush(Color.Black); } if (ferg == "White") { b = new SolidBrush(Color.White); } if (ferg == "Fuchsia") { b = new SolidBrush(Color.Fuchsia); } if (ferg == "1Yellow") { b = new SolidBrush(Color.Silver); } float fAngle = float.Parse(Request.QueryString.GetValues("angle").GetValue(i).ToString()); g.FillPie(b, 5, 5, iWidth-10, iHeight-10, fStart, fAngle); g.DrawPie(Pens.Black, 5, 5, iWidth-10, iHeight-10, fStart, fAngle); fStart += fAngle; } /* g.DrawRectangle(Pens.Black, 0, 0, iWidth-1, iHeight-1); */ g.DrawString(text, new Font("Arial", 10, FontStyle.Regular), SystemBrushes.WindowText, new PointF(5,5)); bmp.Save(Response.OutputStream, ImageFormat.Gif); } catch { g.DrawString("Error", new Font("Arial", 10, FontStyle.Regular), SystemBrushes.WindowText, new PointF(5,5)); } finally { g.Dispose(); bmp.Dispose(); Response.End(); } %>