Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using (Bitmap bmp = new Bitmap(bigW, bigH))
- {
- using (Graphics g = Graphics.FromImage(bmp))
- {
- foreach (Individual person in indList)
- {
- individualName = person.fullName;
- dateBirth = person.dateOfBirth.ToString();
- dateDeath = person.dateOfDeath.ToString();
- yCoordinate = yCoordinate + 130;
- //Draws a rectangle and fills it with the information retrieved from the database
- g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
- g.Clear(Color.Bisque);
- g.DrawRectangle(Pens.Brown, xCoordinate, yCoordinate, width, height);
- g.DrawString(individualName,
- new Font("Arial", 10, FontStyle.Bold),
- SystemBrushes.WindowText,
- new PointF(20, yCoordinate),
- new StringFormat());
- g.DrawString(dateBirth,
- new Font("Arial", 10, FontStyle.Bold),
- SystemBrushes.WindowText,
- new PointF(20, yCoordinate + 15),
- new StringFormat());
- g.DrawString(dateDeath, new Font("Arial", 10, FontStyle.Bold),
- SystemBrushes.WindowText,
- new PointF(20, yCoordinate + 30),
- new StringFormat());
- g.DrawString(familyName, new Font("Arial", 10, FontStyle.Bold),
- SystemBrushes.WindowText,
- new PointF(titleLocation, 10),
- new StringFormat());
- g.FillRectangle(new SolidBrush(Color.FromArgb(alpha, red,
- green, blue)), xCoordinate, yCoordinate, width, height);
- g.DrawRectangle(Pens.Azure, (bigW/2), 1, 1, bigH); //Draws a line down the middle of the page, currently only testing for Johnson
- }
- // Saves it?? Outputs an image??
- string filename = Server.MapPath("/") + Guid.NewGuid().ToString("N");
- bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);
- byte[] bytes;
- using (System.IO.FileStream stream = new System.IO.FileStream(filename, System.IO.FileMode.Open))
- {
- bytes = new byte[stream.Length];
- stream.Read(bytes, 0, bytes.Length);
- }
- System.IO.File.Delete(filename);
- return new FileContentResult(bytes, "image/jpeg");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement