Hi all,
I have a simple program that creates a series of PNG images based on a range of numbers, ie; 1 through 10. I iterate through each number and create a png image of that number, in various sizes. Below is the void that I use to create the images.
private void CreatePNG(int number, string location, int width, int height)
{
string filename = number.ToString() + "-" + width.ToString() + "x" + height.ToString() + ".png";
Bitmap b = new Bitmap(width, height);
Graphics g = Graphics.FromImage((System.Drawing.Image)b);
g.FillRectangle(Brushes.White, 0f, 0f, width, height);
StringFormat f = new StringFormat();
f.Alignment = StringAlignment.Center;
f.LineAlignment = StringAlignment.Center;
g.DrawString(number.ToString(), new Font("Helvetica", 55), Brushes.Black, new RectangleF(0, 0, width, height), f);
b.Save(location + "\\" + filename, ImageFormat.Png);
}
What I would like to do is translate this void to work with WPF. I currently have zero experience with WPF, hence my noobie question.
Target framework is 4.0
Help is much appreciated.
No comments:
Post a Comment