示例#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);
        }
示例#2
0
        public DrawingCanvas()
        {
            InitializeComponent();
            shapeManager = new ShapeManager(this);

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

            this.SetStyle(ControlStyles.DoubleBuffer |
                          ControlStyles.UserPaint |
                          ControlStyles.AllPaintingInWmPaint,
                          true);
            this.UpdateStyles();
        }
示例#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;
 }
 public FormShapeProperties(ShapeManager manager)
 {
     InitializeComponent();
     refManager = manager;
 }
 public GDIGenerationTool(ShapeManager shapeManager)
 {
     manager = shapeManager; //copy the memory reference
 }
 public FormShapeProperties(ShapeManager manager)
 {
     InitializeComponent();
     refManager = manager;
 }
 public GDIGenerationTool(ShapeManager shapeManager)
 {
     manager = shapeManager; //copy the memory reference
 }