Пример #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.Bitmap != null)
                {
                    RectangleF     rcWorld    = Controller.View.ViewToWorld(Controller.View.DeviceToView(rcDevice));
                    BitmapNode     BitmapNode = new BitmapNode(this.bitmap, rcWorld);
                    InsertNodesCmd cmd        = new InsertNodesCmd();
                    cmd.Nodes.Add(BitmapNode);
                    this.Controller.ExecuteCommand(cmd);
                }

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