...einschränken, dass das Formular nur auf dem Arbeitsplatz bewegt werden kann?
Autor: binary[lv]
{ .... }
type
TForm1 = class(TForm)
private
protected
procedure WMMoving(var Message: TWMMoving); message WM_MOVING;
public
end;
{ .... }
procedure TForm1.WMMoving(var Message: TWMMoving);
var
rec: ^TRect;
wrk: TRect;
begin
SystemParametersInfo(spi_getworkarea, 0, @wrk, 0);
rec := Pointer(Message.DragRect);
if rec^.Left < wrk.Left then
begin
rec^.Right := rec^.Right - (rec^.Left - wrk.Left);
rec^.Left := wrk.Left;
end
else if rec^.Right > wrk.Right then
begin
rec^.Left := rec^.Left - (rec^.Right - wrk.Right);
rec^.Right := wrk.Right;
end;
if rec^.Top < wrk.Top then
begin
rec^.Bottom := rec^.Bottom - (rec^.Top - wrk.Top);
rec^.Top := wrk.Top;
end
else if rec^.Bottom > wrk.Bottom then
begin
rec^.Top := rec^.Top - (rec^.Bottom - wrk.Bottom);
rec^.Bottom := wrk.Bottom;
end;
end;
printed from
www.swissdelphicenter.ch
developers knowledge base