help..any one helpp..!
-
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:);
-
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:);
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
-
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
-
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:);
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?
-
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?
-
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:);
Try this link.... It shows how to write structure to file http://www.codeproject.com/useritems/readwritestructstobinfile.asp[^]
-
Try this link.... It shows how to write structure to file http://www.codeproject.com/useritems/readwritestructstobinfile.asp[^]
-
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..!!:^)
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?
-
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?
-
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;;)
http://msdn2.microsoft.com/en-us/library/ms384775(VS.71).aspx U'll find lots of good stuff in it
-
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;;)
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.....