打印本文 打印本文 关闭窗口 关闭窗口
控件移动类的实现之二
作者:武汉SEO闵涛  文章来源:敏韬网  点击数6986  更新时间:2009/4/23 18:30:39  文章录入:mintao  责任编辑:mintao
    begin

     MoveRightTopPoint;

     reSizeCon

    end

    else if FPointRec.RightButton.isDown then

    begin

     MoveRightBottomPoint;

     reSizeCon

    end

    else if FPointRec.LeftMid.isDown then

    begin

     MoveLeftMidPoint;

     reSizeCon

    end

    else if FPointRec.TopMid.isDown then

    begin

     MoveTopMidPoint;

     reSizeCon

    end

    else if FPointRec.RightMid.isDown then

    begin

     MoveRightMidPoint;

     reSizeCon

    end

    else if FPointRec.ButtonMid.isDown then

    begin

     MoveBottomMidPoint;

     reSizeCon

    end

  end;

end;

 

procedure TDragClass.PointMouseUp(Sender: TObject; Button: TMouseButton;

  Shift: TShiftState; X, Y: Integer);

begin

   if Button= mbLeft then

   begin

     if (FpointRec.LeftTop.isDown) and

     (Sender=FpointRec.LeftTop) then

       FpointRec.LeftTop.isDown:=False

     else if (FpointRec.LeftBottom.isDown) and

     (Sender=FpointRec.LeftBottom) then

       FpointRec.LeftBottom.isDown:=False

     else if (FpointRec.RightTop.isDown) and

     (Sender=FpointRec.RightTop) then

       FpointRec.RightTop.isDown:=False

       else if (FpointRec.RightButton.isDown) and

     (Sender=FpointRec.RightButton) then

       FpointRec.RightButton.isDown:=False

     else if (FpointRec.LeftMid.isDown) and

     (Sender=FpointRec.LeftMid) then

       FpointRec.LeftMid.isDown:=False

     else if (FpointRec.TopMid.isDown) and

     (Sender=FpointRec.TopMid) then

       FpointRec.TopMid.isDown:=False

     else if (FpointRec.RightMid.isDown) and

     (Sender=FpointRec.RightMid) then

       FpointRec.RightMid.isDown:=False

     else if (FpointRec.ButtonMid.isDown) and

     (Sender=FpointRec.ButtonMid) then

       FpointRec.ButtonMid.isDown:=False;

   end;

end;

//左顶点的移动

procedure TDragClass.MoveLeftTopPoint;

var offsetX,offsetY:Integer;

begin

     GetCursorPos(FPointRec.LeftTop.NextP);

     offsetX:=FPointRec.LeftTop.NextP.X-FPointRec.LeftTop.PrevP.X;

     offSetY:=FPointRec.LeftTop.NextP.Y-FPointRec.LeftTop.PrevP.Y;

     if not FisMoveStep then

     begin

       FPointRec.LeftTop.Left:=FPointRec.LeftTop.Left+offsetX;

       FPointRec.LeftTop.Top:=FPointRec.LeftTop.Top+offsetY;

     end

     else begin

       MoveX:=MoveX+offsetX;

       MoveY:=MoveY+offsetY;

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口