procedure Tfrm_passedit.imgCloseButtonClick(Sender: TObject);
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_CLOSE, 0);
end;
procedure Tfrm_passedit.imgCaptionMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Button=mbLeft)and(ssLeft in Shift)then
begin
canmove:=true;
Canvas:=TCanvas.Create;
with Canvas do
begin
pen.Style :=psdot;
brush.Style :=bsClear;
pen.Width :=2;
Pen.Mode :=pmNotXor;
Handle :=GetDC(0);
Rectangle(left,top,Left+width,top+height);
curPoint.X :=X;
curPoint.Y :=Y;
oldPoint.X :=Left;
oldPoint.Y :=Top;
end; //end with
end; //end if
end;
procedure Tfrm_passedit.imgCaptionMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if not canmove then exit;
with Canvas do
begin
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
oldPoint.x :=Left +X-curPoint.x;
oldPoint.y :=Top +Y-curPoint.y;
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
end;
end;
procedure Tfrm_passedit.imgCaptionMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if not canmove then exit;
with Canvas do
begin
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
Left :=oldPoint.x;
Top :=oldPoint.y;
Free;
end;
canmove:=not canmove;
end;
procedure Tfrm_passedit.FormCreate(Sender: TObject);
begin
lbCaption.Caption :=Caption;
end;