procedure TForm1.SchaltflaecheMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
r:TRect;
begin
SchaltflaecheUmbewegen := TLMDDockSpeedButton (Sender);
if [ssLeft,ssRight]*Shift=[ssLeft,ssRight]
then exit;
with TControl(Sender)
do
begin
p :=ClientToScreen(Point(x,y));
r :=Parent.ClientRect;
r.TopLeft :=Parent.ClientToScreen(r.TopLeft);
r.BottomRight :=Parent.ClientToScreen(r.BottomRight);
inc(r.Left,x);
dec(r.Right,Width-x);
inc(r.Top,y);
dec(r.Bottom,Height-y);
ClipCursor(@r);
end;
end;
procedure TForm1.SchaltflaecheMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
var
mpos:TPoint;
begin
if [ssLeft,ssRight]*Shift=[]
then exit;
with TControl(Sender)
do begin
mpos :=ClientToScreen(Point(x,y));
x := mpos.x - p.x;
y := mpos.y - p.y;
SetBounds(Left+x,Top+y,Width,Height);
p := mpos;
end;
end;
procedure TForm1.SchaltflaecheMouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
begin
if [ssLeft,ssRight]*Shift<>[]
then exit;
ClipCursor(
nil);
end;