Read from text file..!
-
heloo guys..thanks alot u really doing agreat job ..any way i have finally created strings for each shape (lines,polygons,..) each string contains informations about the shape( x1,y1,x2,y2,R,G,B,pen width) ..Now how can i make my prog read from the text and draw the shapes ..as example the line string : public void AddSv(Line l , ref string str) { if(drawwhat==1)// as one means lines str +="1"+"\n"+l.First.X.ToString()+"\n"+ l.First.Y.ToString()+"\n"+ l.Second.X.ToString()+"\n"+ l.Second.Y.ToString()+"\n"+ l.Pen.Color.R.ToString()+"\n"+ l.Pen.Color.G.ToString()+"\n"+ l.Pen.Color.B.ToString()+"\n"+ l.Pen.Width.ToString()+"\n\n"; after i draw the line i click on save to send the informations to the text : private void button1_Click(object sender, System.EventArgs e) { //save System.IO.FileStream fs = new System.IO.FileStream("c:\\graphics.txt", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite); StreamWriter streamWriter=new StreamWriter(fs); streamWriter.WriteLine(LineSv); streamWriter.Flush(); streamWriter.Close(); fs.Close(); } Regards;P;
-
heloo guys..thanks alot u really doing agreat job ..any way i have finally created strings for each shape (lines,polygons,..) each string contains informations about the shape( x1,y1,x2,y2,R,G,B,pen width) ..Now how can i make my prog read from the text and draw the shapes ..as example the line string : public void AddSv(Line l , ref string str) { if(drawwhat==1)// as one means lines str +="1"+"\n"+l.First.X.ToString()+"\n"+ l.First.Y.ToString()+"\n"+ l.Second.X.ToString()+"\n"+ l.Second.Y.ToString()+"\n"+ l.Pen.Color.R.ToString()+"\n"+ l.Pen.Color.G.ToString()+"\n"+ l.Pen.Color.B.ToString()+"\n"+ l.Pen.Width.ToString()+"\n\n"; after i draw the line i click on save to send the informations to the text : private void button1_Click(object sender, System.EventArgs e) { //save System.IO.FileStream fs = new System.IO.FileStream("c:\\graphics.txt", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite); StreamWriter streamWriter=new StreamWriter(fs); streamWriter.WriteLine(LineSv); streamWriter.Flush(); streamWriter.Close(); fs.Close(); } Regards;P;
Don't cross post:mad:
only two letters away from being an asset
-
heloo guys..thanks alot u really doing agreat job ..any way i have finally created strings for each shape (lines,polygons,..) each string contains informations about the shape( x1,y1,x2,y2,R,G,B,pen width) ..Now how can i make my prog read from the text and draw the shapes ..as example the line string : public void AddSv(Line l , ref string str) { if(drawwhat==1)// as one means lines str +="1"+"\n"+l.First.X.ToString()+"\n"+ l.First.Y.ToString()+"\n"+ l.Second.X.ToString()+"\n"+ l.Second.Y.ToString()+"\n"+ l.Pen.Color.R.ToString()+"\n"+ l.Pen.Color.G.ToString()+"\n"+ l.Pen.Color.B.ToString()+"\n"+ l.Pen.Width.ToString()+"\n\n"; after i draw the line i click on save to send the informations to the text : private void button1_Click(object sender, System.EventArgs e) { //save System.IO.FileStream fs = new System.IO.FileStream("c:\\graphics.txt", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite); StreamWriter streamWriter=new StreamWriter(fs); streamWriter.WriteLine(LineSv); streamWriter.Flush(); streamWriter.Close(); fs.Close(); } Regards;P;
-
mr jets wrote:
Now how can i make my prog read from the text
System.Runtime.Serialization
led mike