Esempio n. 1
0
        public override bool MouseUp(MouseEventArgs e)
        {
            if (this.Resizing)
            {
                this.Resizing = false;
                _CalcNewLeftTop();  // 计算新的LeftTop

                this.Width  = Math.Abs(FShapeLine.EndPt.X - FShapeLine.StartPt.X);
                this.Height = Math.Abs(FShapeLine.EndPt.Y - FShapeLine.StartPt.Y);
            }
            else
            if (FShapeLine.ActiveObj == HCShapeLineObj.sloLine)
            {
                _CalcNewLeftTop();  // 计算新的LeftTop
            }
            return(FShapeLine.MouseUp(e));
        }
Esempio n. 2
0
        public override bool MouseUp(MouseEventArgs e)
        {
            if (this.Resizing)
            {
                this.Resizing = false;
                POINT vNewLeftTop = new POINT();

                // 缩放后的Rect的LeftTop
                if (FShapeLine.StartPt.X < FShapeLine.EndPt.X)
                {
                    vNewLeftTop.X = FShapeLine.StartPt.X;
                }
                else
                {
                    vNewLeftTop.X = FShapeLine.EndPt.X;
                }

                if (FShapeLine.StartPt.Y < FShapeLine.EndPt.Y)
                {
                    vNewLeftTop.Y = FShapeLine.StartPt.Y;
                }
                else
                {
                    vNewLeftTop.Y = FShapeLine.EndPt.Y;
                }

                vNewLeftTop.X = vNewLeftTop.X - FLeftTop.X;
                vNewLeftTop.Y = vNewLeftTop.Y - FLeftTop.Y;

                this.Left = this.Left + vNewLeftTop.X;
                this.Top  = this.Top + vNewLeftTop.Y;
                // 线的点坐标以新LeftTop为原点
                FShapeLine.StartPt.Offset(-vNewLeftTop.X, -vNewLeftTop.Y);
                FShapeLine.EndPt.Offset(-vNewLeftTop.X, -vNewLeftTop.Y);

                this.Width  = Math.Abs(FShapeLine.EndPt.X - FShapeLine.StartPt.X);
                this.Height = Math.Abs(FShapeLine.EndPt.Y - FShapeLine.StartPt.Y);
            }

            return(FShapeLine.MouseUp(e));
        }