Exemple #1
0
        public override bool DelegateMouseMove(object sender, MouseEventArgs e, ICoorConverter cvt = null)
        {
            if ((ModifierKeys & Keys.Control) == Keys.Control)
            {
                return(true);
            }

            System.Drawing.Point point = e.Location;
            if (cvt != null)
            {
                point = cvt.ReConvert(point);
            }

            if (Utils.Judge.Mouse.Left(e))
            {
                if (Status == BrushStatus.Free || Status == BrushStatus.Building)
                {
                    Status = BrushStatus.Building;
                    System.Drawing.Rectangle rect = RectangleTransform.FromTwoPoints(downPoint, point);

                    TempAnno.x      = rect.X;
                    TempAnno.y      = rect.Y;
                    TempAnno.width  = rect.Width;
                    TempAnno.height = rect.Height;
                }
                else
                {
                    Size delta = new Size(point.X - downPoint.X, point.Y - downPoint.Y);

                    TempAnno.x = downTempAnno.x + delta.Width;
                    TempAnno.y = downTempAnno.y + delta.Height;
                }
                (sender as Control).Invalidate();
                GlobalMessage.Add("status", TempAnno.ToString());
            }
            else if (e.Button == MouseButtons.None)
            {
                if (Status == BrushStatus.Free && TempAnno != null)
                {
                    TempAnno.x = point.X - TempAnno.width / 2;
                    TempAnno.y = point.Y - TempAnno.height / 2;

                    (sender as Control).Invalidate();
                    GlobalMessage.Add("status", TempAnno.ToString());
                }
            }

            return(true);
        }
Exemple #2
0
        //Override
        public override bool DelegateMouseDown(object sender, MouseEventArgs e, ICoorConverter cvt = null)
        {
            if (Utils.Judge.Mouse.Left(e))
            {
                System.Drawing.Point point = e.Location;
                if (cvt != null)
                {
                    point = cvt.ReConvert(point);
                }
                downPoint    = point;
                downTempAnno = TempAnno.Clone() as Annotation;
            }

            return(true);
        }