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. help..any one helpp..!

help..any one helpp..!

Scheduled Pinned Locked Moved C#
graphicshelp
11 Posts 4 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

    hello guys..my program is about drawing some shapes like (lines ,polygons..etc)my nightmare is after drawing the :)shapes i wanna to save them as atext which contains the (start point , end point , color ,..etc) iam using V.S 2003...i will apprecaite any help . Regards:);

    C M 2 Replies Last reply
    0
    • M mr jets

      hello guys..my program is about drawing some shapes like (lines ,polygons..etc)my nightmare is after drawing the :)shapes i wanna to save them as atext which contains the (start point , end point , color ,..etc) iam using V.S 2003...i will apprecaite any help . Regards:);

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      mr jets wrote:

      i wanna to save them as atext which contains the (start point , end point , color ,..etc)

      The first step is to define the format of the text. I presume this will be a text file that will have to be read back in at some point.


      Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

      M 1 Reply Last reply
      0
      • C Colin Angus Mackay

        mr jets wrote:

        i wanna to save them as atext which contains the (start point , end point , color ,..etc)

        The first step is to define the format of the text. I presume this will be a text file that will have to be read back in at some point.


        Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

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

        yah bro..thats right i wanna to save my drawing as text file..but iam stuck..!:confused:

        1 Reply Last reply
        0
        • M mr jets

          hello guys..my program is about drawing some shapes like (lines ,polygons..etc)my nightmare is after drawing the :)shapes i wanna to save them as atext which contains the (start point , end point , color ,..etc) iam using V.S 2003...i will apprecaite any help . Regards:);

          M Offline
          M Offline
          Mandaar Kulkarni
          wrote on last edited by
          #4

          1. First decide which all properties you want to save to the text file. 2. Create a structure for holding data for the shape using these properties. 3. Design the structure in such a way that it will cover most common properties for all shapes. 4. When you draw the shape, copy the values to the instanece of structure. 5. Finally write the structure to the file. How about this?

          M 1 Reply Last reply
          0
          • M Mandaar Kulkarni

            1. First decide which all properties you want to save to the text file. 2. Create a structure for holding data for the shape using these properties. 3. Design the structure in such a way that it will cover most common properties for all shapes. 4. When you draw the shape, copy the values to the instanece of structure. 5. Finally write the structure to the file. How about this?

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

            mmmm..sounds look cool my friend..but i didnt get any thing :-O..do u know any usefull article about this..i will be greatfull.! Regards:);

            M 1 Reply Last reply
            0
            • M mr jets

              mmmm..sounds look cool my friend..but i didnt get any thing :-O..do u know any usefull article about this..i will be greatfull.! Regards:);

              M Offline
              M Offline
              Mandaar Kulkarni
              wrote on last edited by
              #6

              Try this link.... It shows how to write structure to file http://www.codeproject.com/useritems/readwritestructstobinfile.asp[^]

              M 1 Reply Last reply
              0
              • M Mandaar Kulkarni

                Try this link.... It shows how to write structure to file http://www.codeproject.com/useritems/readwritestructstobinfile.asp[^]

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

                thanks alot bro..but we are not on the same page..ok assume that i draw aline i want after clicking on save button..it will save the (start point , end point ,RGB ,...)of that line in text file..!!:^)

                M 1 Reply Last reply
                0
                • M mr jets

                  thanks alot bro..but we are not on the same page..ok assume that i draw aline i want after clicking on save button..it will save the (start point , end point ,RGB ,...)of that line in text file..!!:^)

                  M Offline
                  M Offline
                  Mandaar Kulkarni
                  wrote on last edited by
                  #8

                  Let me make it simpler for you... When you are drawing line, you have its information like start point, end point, RGB. Create a structure e.g. structLine which contains members for holding start point , end point (each of appropriate type). Copy the values to objLine of type structLine before you call DrawLine Method. When you click Save button // create a writer and open the file TextWriter tw = new StreamWriter("line.txt"); // write a line of text to the file tw.WriteLine(objLine.StartPoint.ToString() + ", " objLine.EndPoint.ToString()); // mention all values of struct // close the stream tw.Close(); I recommand you override the method ToString() method of structLine in which you provide way to represent the structure in sting format. Now is this okey?

                  M 1 Reply Last reply
                  0
                  • M Mandaar Kulkarni

                    Let me make it simpler for you... When you are drawing line, you have its information like start point, end point, RGB. Create a structure e.g. structLine which contains members for holding start point , end point (each of appropriate type). Copy the values to objLine of type structLine before you call DrawLine Method. When you click Save button // create a writer and open the file TextWriter tw = new StreamWriter("line.txt"); // write a line of text to the file tw.WriteLine(objLine.StartPoint.ToString() + ", " objLine.EndPoint.ToString()); // mention all values of struct // close the stream tw.Close(); I recommand you override the method ToString() method of structLine in which you provide way to represent the structure in sting format. Now is this okey?

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

                    yah its much better..thanks bro..i will be more geatfull if u recommended me any usefull article about that..cuz iam dealing with alot of shapes ..not just lines...thanks again for ur time. cheers;;)

                    L M 2 Replies Last reply
                    0
                    • M mr jets

                      yah its much better..thanks bro..i will be more geatfull if u recommended me any usefull article about that..cuz iam dealing with alot of shapes ..not just lines...thanks again for ur time. cheers;;)

                      L Offline
                      L Offline
                      Leyu
                      wrote on last edited by
                      #10

                      http://msdn2.microsoft.com/en-us/library/ms384775(VS.71).aspx U'll find lots of good stuff in it

                      1 Reply Last reply
                      0
                      • M mr jets

                        yah its much better..thanks bro..i will be more geatfull if u recommended me any usefull article about that..cuz iam dealing with alot of shapes ..not just lines...thanks again for ur time. cheers;;)

                        M Offline
                        M Offline
                        Mandaar Kulkarni
                        wrote on last edited by
                        #11

                        I don't know whether any article exists for such case, but I can give you some more hints about this as you know now how to deal with lines. Take out a list of values that are required for all the shapes that you are using. Create a structure e.g. structShape which contains members for holding all the values. Include a shapeType field in the structShape which will let you know what type of shape you are drawing. It might be the case that a shape would not contain all the properties. So copy values that are available and keep the remaining blank (or something like "NA" which means not applicable for this type of shape). I recommand using structure because if you want to read again from that file you can read in the same sequence that you wrote to the file. Your shapeType attribute will decide which shape is to be drawn. Is that fair enough? Let me know if any problem in this.....

                        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