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. Other Discussions
  3. IT & Infrastructure
  4. saving drawings as atext file..!!

saving drawings as atext file..!!

Scheduled Pinned Locked Moved IT & Infrastructure
graphicshelp
3 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

    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 file which contains the (start point , end point , color ,..etc) iam using V.S 2003...i will apprecaite any help . Regards:);

    realJSOPR A 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 file which contains the (start point , end point , color ,..etc) iam using V.S 2003...i will apprecaite any help . Regards:);

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #2

      Seems to me it would be easy to implement. I would probably start with a file that contains a series of comma-delimited string with the following structure: SHAPETYPE,LINECOLOR,FILLCOLOR,FONT,TEXT,POINTS Where... SHAPETYPE would be 0=point, 1=line, 2=polygon, 3=ellipse 4=text LINECOLOR would be the integer representation of the desired pen color used to draw the shape FILLCOLOR would be the integer representation of the desired fill color (you could use -1 to indicate no color) FONT would be a quoted string that represents the font to be used if this is a text element (shapetype=4) TEXT would be the quoted text to be displayed if this is a text element (shapetype=4) POINTS would be a quoted space-delimited list of points contained within quotes like "0,1 255,123" etc You could then use my handy dandy string parsing class[^] to parse the string twice. Once to separate the major sections, and once more to parse the string of points. If it were me, I'd build a class that accepted the unparsed string and a pointer to a device context, and let the class parse and draw the commands in the order they are read from the file. You'd have to setup a switch statement to handle each command appropriately. That should be enough to get you going. BTW, this is basic design stuff. If you can't learn how to do this on your own, you're going to be relegated to doing nothing but maintenance coding (if you manage to remain employed as a programmer) because you never taught yourself to think on your feet.

      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      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 file which contains the (start point , end point , color ,..etc) iam using V.S 2003...i will apprecaite any help . Regards:);

        A Offline
        A Offline
        Arun Immanuel
        wrote on last edited by
        #3

        Or create a class that contain all the relevant details of the shapes like: class BaseClass { int shapeType; } class Circle:BaseClass { Point pt; int radius; other properties like color,etc. } class Line:BaseClass { Point p1,p2; ------------ ------------ } class _shapes { Arraylist allShapes; } Create an object for _shapes class; Finally, serialize the object and store it is a text file and again construct the object by deserializing. I did like that, when I developed a software to create any type of games.

        Regards, Arun Kumar.A

        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