Ejemplo n.º 1
0
        //public bool Open()
        //{
        //    bool blnSuccess = false;
        //    using (OpenFileDialog OFD = new OpenFileDialog())
        //    {
        //        try
        //        {
        //            OFD.Filter = "Photo Brush Project File (*.pbp)|*.pbp";
        //            OFD.DefaultExt = ".pbp";
        //            OFD.Title = "Open Photo Brush Project File";
        //            OFD.ShowDialog();

        //            if (OFD.FileName != "")
        //            {
        //                shapeManager.FileName = OFD.FileName;
        //                using (FileStream FS = new FileStream(shapeManager.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
        //                {
        //                    BinaryFormatter BF = new BinaryFormatter();
        //                    ShapeManager TMP = (ShapeManager)BF.Deserialize(FS);
        //                    TMP.RestoreNonSerializable(this);
        //                    shapeManager.Dispose();
        //                    shapeManager = null;
        //                    shapeManager = TMP;
        //                }
        //                blnSuccess = true;
        //                this.Invalidate();
        //            }
        //        }
        //        catch (Exception E) { MessageBox.Show(E.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        //    }
        //    return blnSuccess;
        //}

        public bool Open()
        {
            bool blnSuccess = false;

            try
            {
                if (shapeManager.FileName != "")
                {
                    //shapeManager.FileName = FilePath;
                    using (FileStream FS = new FileStream(shapeManager.FileName, FileMode.OpenOrCreate))//new FileStream(shapeManager.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        BinaryFormatter BF  = new BinaryFormatter();
                        ShapeManager    TMP = (ShapeManager)BF.Deserialize(FS);
                        TMP.RestoreNonSerializable(this);
                        shapeManager.Dispose();
                        shapeManager = null;
                        shapeManager = TMP;
                    }
                    blnSuccess = true;
                    this.Invalidate();
                }
            }
            catch (Exception E) { MessageBox.Show(E.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
            return(blnSuccess);
        }
Ejemplo n.º 2
0
        public DrawingCanvas()
        {
            InitializeComponent();
            shapeManager = new ShapeManager(this);

            this.SetStyle(ControlStyles.DoubleBuffer |
                          ControlStyles.UserPaint |
                          ControlStyles.AllPaintingInWmPaint,
                          true);
            this.UpdateStyles();
        }
Ejemplo n.º 3
0
        public DrawingCanvas()
        {
            InitializeComponent();
            shapeManager = new ShapeManager(this);

            this.SetStyle(ControlStyles.DoubleBuffer |
                          ControlStyles.UserPaint |
                          ControlStyles.AllPaintingInWmPaint,
                          true);
            this.UpdateStyles();
        }
Ejemplo n.º 4
0
 //public bool Open()
 //{
 //    bool blnSuccess = false;
 //    using (OpenFileDialog OFD = new OpenFileDialog())
 //    {
 //        try
 //        {
 //            OFD.Filter = "Photo Brush Project File (*.pbp)|*.pbp";
 //            OFD.DefaultExt = ".pbp";
 //            OFD.Title = "Open Photo Brush Project File";
 //            OFD.ShowDialog();
 //            if (OFD.FileName != "")
 //            {
 //                shapeManager.FileName = OFD.FileName;
 //                using (FileStream FS = new FileStream(shapeManager.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
 //                {
 //                    BinaryFormatter BF = new BinaryFormatter();
 //                    ShapeManager TMP = (ShapeManager)BF.Deserialize(FS);
 //                    TMP.RestoreNonSerializable(this);
 //                    shapeManager.Dispose();
 //                    shapeManager = null;
 //                    shapeManager = TMP;
 //                }
 //                blnSuccess = true;
 //                this.Invalidate();
 //            }
 //        }
 //        catch (Exception E) { MessageBox.Show(E.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 //    }
 //    return blnSuccess;
 //}
 public bool Open()
 {
     bool blnSuccess = false;
     try
     {
         if (shapeManager.FileName != "")
         {
             //shapeManager.FileName = FilePath;
             using (FileStream FS = new FileStream(shapeManager.FileName, FileMode.OpenOrCreate))//new FileStream(shapeManager.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
             {
                 BinaryFormatter BF = new BinaryFormatter();
                 ShapeManager TMP = (ShapeManager)BF.Deserialize(FS);
                 TMP.RestoreNonSerializable(this);
                 shapeManager.Dispose();
                 shapeManager = null;
                 shapeManager = TMP;
             }
             blnSuccess = true;
             this.Invalidate();
         }
     }
     catch (Exception E) { MessageBox.Show(E.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
     return blnSuccess;
 }
Ejemplo n.º 5
0
 public FormShapeProperties(ShapeManager manager)
 {
     InitializeComponent();
     refManager = manager;
 }
Ejemplo n.º 6
0
 public GDIGenerationTool(ShapeManager shapeManager)
 {
     manager = shapeManager; //copy the memory reference
 }
Ejemplo n.º 7
0
 public FormShapeProperties(ShapeManager manager)
 {
     InitializeComponent();
     refManager = manager;
 }
Ejemplo n.º 8
0
 public GDIGenerationTool(ShapeManager shapeManager)
 {
     manager = shapeManager; //copy the memory reference
 }