下面是TDragClass的源代碼,比如多,可以拷去機上試試,再慢慢看:
//------TDragClass------------------------
unit uDrag;
interface
uses Windows, Messages,Classes,SysUtils,Controls,Graphics,
uDragPoint,StdCtrls;
type
//控件的八個點,用於拉動大小
TPointRec=record
LeftTop:TDragPoint;
LeftBottom:TDragPoint;
RightTop:TDragPoint;
RightButton:TDragPoint;
LeftMid:TDragPoint;
TopMid:TDragPoint;
RightMid:TDragPoint;
ButtonMid:TDragPoint;
end;
TDragClass=class
private
FConList:TList; //保存控件的列表
FCurActiveCon:Integer; //當前活動控件
FPointRec:TPointRec; //當前控件的邊緣的八個小點
//跳躍式移動的成員
FisMoveStep:Boolean;
FMoveStep:integer;
MoveX,MoveY:integer;
//控件事件相關的成員
FConMouseDown:TMouseEvent;
FConMouseMove:TMouseMoveEvent;
FConMouseup:TMouseEvent;
isDown:Boolean;
prevP,nextP:TPoint;
protected
//-------對移動點的操作--
procedure CreateDragPoint(PointParent:TWinControl);
procedure SetPointPos(posRect:TRect);
procedure SetPointParent(PointParent:TWinControl);
procedure SetPointEvent;
procedure SetCurActiveCon(curCon:Pointer);
//----------------------
procedure MoveLeftTopPoint;
procedure AlignLeftTop;
procedure MoveLeftBottomPoint;
procedure AlignLeftBottom;
&nbs
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一頁 >>