Fórum Proibir Usuário de Arrastar um Form #165006
06/06/2003
0
Allan Elias Ramos :wink:
Aersoftware
Curtir tópico
+ 0Posts
06/06/2003
Lulinha
public
{ Public declarations }
L,T:integer;
OnCreate (do formulário):
procedure TForm1.FormCreate(Sender: TObject);
begin
L:=left;
T:=top;
end;
E depois coloque os seguintes códigos nos eventos do fomulário:
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if (left<>l) or (top<>t) then
begin
Form1.left:=l;
form1.top:=t;
abort;
end;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (left<>l) or (top<>t) then
begin
Form1.left:=l;
form1.top:=t;
abort;
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (left<>l) or (top<>t) then
begin
Form1.left:=l;
form1.top:=t;
abort;
end;
end;
OBS.: Nesse caso o usuário move o formulário só que quando o mouse volta para o formulário este retorna para a sua posição original.
Espero ter ajudado!
Um abraço! Luís Ledebour.
Gostei + 0
07/06/2003
Sandra
Allan,
Procure pelas seguintes propriedades do Form:
:arrow: BorderStyle - bsSingle (não redimensionar)
:arrow: Align – alCustom (não mover)
Eu utilizo o Delphi 6 e funciona...
:wink:
Gostei + 0
07/06/2003
Aersoftware
Allan Elias Ramos :wink:
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)