Example #1
0
        /// <summary>
        /// Mouse move function.
        /// </summary>
        /// <param name="document">Informations transferred from DrawingPanel.</param>
        /// <param name="e">MouseEventArgs.</param>
        public override void MouseMove(Sbn.FramWork.Drawing.IDocument document, System.Windows.Forms.MouseEventArgs e)
        {
            base.MouseMove(document, e);

            if (!MousePressed)
            {
                return;
            }

            PointF point = document.GridManager.GetRoundedPoint(e.Location);

            if (Math.Abs(point.Y - _oldPoint.Y) > 20)
            {
            }

            Ghost.Transformer.Translate(point.X - _oldPoint.X, point.Y - _oldPoint.Y);
            Ghost.MouseMove(document, e);

            _oldPoint = Point.Round(point);
        }
Example #2
0
        /// <summary>
        /// Mouse move function.
        /// </summary>
        /// <param name="document">Informations transferred from DrawingPanel.</param>
        /// <param name="e">MouseEventArgs.</param>
        public override void MouseMove(Sbn.FramWork.Drawing.IDocument document, System.Windows.Forms.MouseEventArgs e)
        {
            base.MouseMove(document, e);

            if (!MousePressed)
            {
                return;
            }

            PointF point = document.GridManager.GetRoundedPoint(e.Location);


            var hChang = point.X - _oldPoint.X;
            var vChang = point.Y - _oldPoint.Y;



            if (!(document.DrawingControl as DrawingPanel).VerticalScroll.Visible)
            {
                vChang = 0;
            }
            else
            {
                if ((document.DrawingControl as DrawingPanel).BackgroundLayer != null)
                {
                    if ((document.DrawingControl as DrawingPanel).BackgroundLayer.Location.Y + vChang > 0)
                    {
                        vChang = 0;
                    }


                    if ((document.DrawingControl as DrawingPanel).VerticalScroll.Value + (document.DrawingControl as DrawingPanel).VerticalScroll.LargeChange - vChang > (document.DrawingControl as DrawingPanel).VerticalScroll.Maximum)
                    {
                        vChang = 0;
                    }
                }
            }

            if (!(document.DrawingControl as DrawingPanel).HorizontalScroll.Visible)
            {
                hChang = 0;
            }
            else
            {
                if ((document.DrawingControl as DrawingPanel).BackgroundLayer != null)
                {
                    if ((document.DrawingControl as DrawingPanel).BackgroundLayer.Location.X + hChang > 0)
                    {
                        hChang = 0;
                    }


                    if ((document.DrawingControl as DrawingPanel).HorizontalScroll.Value + (document.DrawingControl as DrawingPanel).HorizontalScroll.LargeChange - hChang > (document.DrawingControl as DrawingPanel).HorizontalScroll.Maximum)
                    {
                        hChang = 0;
                    }
                }
            }

            bool historyIsActive = History <ShapeCollection> .IsActive;

            History <ShapeCollection> .IsActive = false;
            foreach (IShape shape in document.Shapes)
            {
                shape.Transformer.ForceTranslate(hChang, vChang);
            }
            History <ShapeCollection> .IsActive = historyIsActive;

            try
            {
                (document.DrawingControl as DrawingPanel).UpdateDrawPanelSize();
                //UpdateDrawPanelSize();
                //VerticalScroll.Value += vChang;
            }
            catch (Exception)
            {
                // throw;
            }

            // lastMouse = new Point(e.X, e.Y);


            //Ghost.Transformer.Translate(point.X - _oldPoint.X, point.Y - _oldPoint.Y);
            //Ghost.MouseMove(document, e);

            _oldPoint = Point.Round(point);
        }