Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Read from text file..!

Read from text file..!

Scheduled Pinned Locked Moved C#
graphicstutorialquestioncareer
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mr jets
    wrote on last edited by
    #1

    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;

    N L 2 Replies Last reply
    0
    • M mr jets

      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;

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Don't cross post:mad:


      only two letters away from being an asset

      1 Reply Last reply
      0
      • M mr jets

        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;

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        mr jets wrote:

        Now how can i make my prog read from the text

        System.Runtime.Serialization

        led mike

        M 1 Reply Last reply
        0
        • L led mike

          mr jets wrote:

          Now how can i make my prog read from the text

          System.Runtime.Serialization

          led mike

          M Offline
          M Offline
          mr jets
          wrote on last edited by
          #4

          thanks..but iam looking for the idea to make it reads line by line and draw the line ..should i use split fuction..or if condition..iam LOST!!:confused:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups