Hi!
I was trying to make an application, in which you can save image and text together. I made my own file type .iaf and associated it with my app, but now i don't know how to save that image and text and then load it again. Please can anyone help?
Thank you
Loading
JanPosted May 23, 2011, 7:51 AM
Sam HobbsPosted May 22, 2011, 9:39 PM
FroglegPosted May 22, 2011, 3:36 PM
JanPosted May 22, 2011, 3:06 PM
FroglegPosted May 22, 2011, 2:27 PM
Bitmap myBmp;
myBmp = new Bitmap(pictureBox1.Image);
myBmp.Save("whatever.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
to save text - using System.IO;
String yourString = "save me";
using (StreamWriter sw = new StreamWriter("fileName.txt"))
{
sw.WriteLine(yourString);
}
to load image
pictureBox1.Image = Image.FromFile("whatever.jpg");
to load text
using (StreamReader sr = new StreamReader("fileName.txt"))
{
yourString = sr.ReadLine();
}