I want to create multiple 200×200 images with a number centered on them and save them with the corresponding file name automatically to a folder. Just that, nothing more.
I figured it’d be best to try this with an imagebox and writing on it with a loop, but I’m getting nowhere. Any ideas?
You are on the right track, bud. However; to accomplish what you want, you’ll need to call the ‘Graphics’ class, available in the System.Drawing namespace.
The task you want done is quite easy.
First loop through the images you wanna create
Lets say you want 5 images
… call the for loop!
Inside the loop we want to create a 200×200 image which is available to edit.
I prefer the ‘Bitmap’ class to accomplish this.
After creating the Bitmap, I’ll create Graphics for it.
Then I will draw the string in approx. the center. If you want the 100% center, you can use the MeasureString function
Final code:
I haven’t tried this code yet, but I assume it works. Few modifications may be needed 🙂