Ejemplo n.º 1
0
 public int readPersistFile()
 {
     GraphicsLibrary.PolylineObjClass obj = new GraphicsLibrary.PolylineObjClass();
     IPersistFile pf = (IPersistFile)obj;
     pf.Load(kFileName, 0);
     foreach (GraphicsLibrary.PolyPoint ptt in obj.Points)
     {
         Trace.WriteLine(String.Format("point ({0}, {1})", ptt.x, ptt.y));
     }
     Marshal.ReleaseComObject(pf);
     Marshal.ReleaseComObject(obj);
     return 0;
 }
Ejemplo n.º 2
0
 public int writePersistFile()
 {
     GraphicsLibrary.PolylineObjClass obj = new GraphicsLibrary.PolylineObjClass();
     GraphicsLibrary.PolyPoint pt = new GraphicsLibrary.PolyPoint();
     pt.x = 1;
     pt.y = 3;
     GraphicsLibrary.PolyPoint pt2 = new GraphicsLibrary.PolyPoint();
     pt2.x = 100;
     pt2.y = 300;
     GraphicsLibrary.PolyPoint[] pts = new GraphicsLibrary.PolyPoint[] { pt, pt2 };
     obj.Points = pts;
     foreach (GraphicsLibrary.PolyPoint ptt in pts)
     {
         Trace.WriteLine(String.Format("point ({0}, {1})", ptt.x, ptt.y));
     }
     IPersistFile pf = (IPersistFile)obj;
     pf.Save(kFileName, true);
     pf.SaveCompleted(kFileName);
     Marshal.ReleaseComObject(pf);
     Marshal.ReleaseComObject(obj);
     return 0;
 }