Пример #1
0
        private void ImageBtn_Click(object sender, EventArgs e)
        {
            deselectAll();
            ImageBtn.Checked = true;
            //这里要添加 _canvas.addShapeEle

            ShapeImage simage = new ShapeImage();

             //这里要选择图片

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    simage.Image = new Bitmap(openFileDialog1.FileName);
                    /**
                    using (System.IO.MemoryStream memory3 = new System.IO.MemoryStream())
                    {

                        (new Bitmap(openFileDialog1.FileName)).Save(memory3, System.Drawing.Imaging.ImageFormat.Png);
                        simage.Image = new Bitmap(memory3);

                    }
                     * */
                }
                catch (Exception exception)
                {
                    //ClsErrorFile.WriteLine(exception);
                    //Console.Error.Write(exception.ToString());
                }
                finally
                {

                }

            }
            else
            {
                //我实在是不知道该怎么提示。

            }

            _canvas.addShapeEle(simage);
        }
Пример #2
0
        public override ShapeEle DeepClone()
        {
            ShapeImage shapeEle = new ShapeImage();
            shapeEle.Zoom = Zoom;
            shapeEle.X = X;
            shapeEle.Y = Y;
            shapeEle.Width = Width;
            shapeEle.Height = Height;
            shapeEle.isFill = isFill;
            shapeEle.PenColor = PenColor;
            shapeEle.PenWidth = PenWidth;
            shapeEle.PenDashStyle = PenDashStyle;
            shapeEle.Route = Route;

            //如下是子类单独的
            shapeEle.Image = new Bitmap(Image);
            shapeEle.OriginalSize = OriginalSize;
            shapeEle.Scaled = Scaled;

            return shapeEle;
            //throw new NotImplementedException();
        }