Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        void IMouseEventReceiver.MouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            if (this.Active && this.drawing)
            {
                System.Drawing.Point     ptCur = new System.Drawing.Point(e.X, e.Y);
                System.Drawing.Rectangle rcDevice;

                if (this.dragSize)
                {
                    rcDevice = Geometry.CreateRect(this.startingPoint, ptCur);
                }
                else
                {
                    int trackingWidth  = this.trackingRect.Width;
                    int trackingHeight = this.trackingRect.Height;
                    int trackingLeft   = ptCur.X - (trackingWidth / 2);
                    int trackingTop    = ptCur.Y - (trackingHeight / 2);
                    rcDevice = new System.Drawing.Rectangle(trackingLeft, trackingTop, trackingWidth, trackingHeight);
                }

                if (this.metafile != null)
                {
                    RectangleF     rcWorld      = Controller.View.ViewToWorld(Controller.View.DeviceToView(rcDevice));
                    MetafileNode   metafileNode = new MetafileNode(this.metafile, rcWorld, GraphicsUnit.Pixel);
                    InsertNodesCmd cmd          = new InsertNodesCmd();
                    cmd.Nodes.Add(metafileNode);
                    this.Controller.ExecuteCommand(cmd);
                }

                this.Controller.DeactivateTool(this);
            }
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="src"></param>
 public MetafileNode(MetafileNode src) : base(src)
 {
     this.metafile = (System.Drawing.Imaging.Metafile)src.metafile.Clone();
     this.grfxUnit = src.grfxUnit;
 }