Fórum Alterar o Form #189153
16/10/2003
0
Oi pessoal, estou criando uma tela de apresentação, nessa tela o usuário não poderá maximizar, minimizar nem fechar a janela, até ai consegui realizar, eu apenas não me lembro como faço para que o usuário não consiga com o mouse alterar o form, arrastar nem ampliar a tela. Desde já agradeço pela ajuda.
Jiu
Curtir tópico
+ 0
Responder
Posts
16/10/2003
Henry
Para ampliar, mude a propiedade AutoSize do form para true. Brother, é isso que posso te dizer por enquanto. Um abraço, Henry.
Responder
Gostei + 0
16/10/2003
Diogoalles
não aumentar o tamanho:
defina a propriedade BorderStyle do Form como bsSingle.
Não redimensionar e deixar tb centralizado
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
procedure WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
procedure WMInitMenuPopup(var Msg: TWMInitMenuPopup); message WM_INITMENUPOPUP;
procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHitTest;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo);
begin
inherited;
with Msg.MinMaxInfo^ do
begin
ptMinTrackSize.x:= form1.width;
ptMaxTrackSize.x:= form1.width;
ptMinTrackSize.y:= form1.height;
ptMaxTrackSize.y:= form1.height;
end;
end;
procedure TForm1.WMInitMenuPopup(var Msg: TWMInitMenuPopup);
begin
inherited;
if Msg.SystemMenu then
EnableMenuItem(Msg.MenuPopup, SC_SIZE, MF_BYCOMMAND or MF_GRAYED)
end;
procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
inherited;
with Msg do
if Result in [HTLEFT, HTRIGHT, HTBOTTOM, HTBOTTOMRIGHT,HTBOTTOMLEFT, HTTOP,HTTOPRIGHT, HTTOPLEFT] then
Result:= HTNOWHERE
end;
end.
Para ele permanecer na mesma posição coloque um Timer, coloque o interval:=1;
No OnTimer;
var
r : TRect;
osv : TOSVersionInfo;
begin
osv.EdwOSVersionInfoSize := sizeof(osv);
GetVersionEx(osv);
if osv.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then
begin
SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0);
Left := ((r.right - r.left) - Width) div 2;
Top := ((r.bottom - r.top) - Height) div 2;
end
else
begin
Left := (GetSystemMetrics(SM_CXSCREEN) - Width) div 2;
Top := (GetSystemMetrics(SM_CYSCREEN) - Height) div 2;
end;
end;
isso vai centralizar o form.
abraço
Diogo
defina a propriedade BorderStyle do Form como bsSingle.
Não redimensionar e deixar tb centralizado
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
procedure WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
procedure WMInitMenuPopup(var Msg: TWMInitMenuPopup); message WM_INITMENUPOPUP;
procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHitTest;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo);
begin
inherited;
with Msg.MinMaxInfo^ do
begin
ptMinTrackSize.x:= form1.width;
ptMaxTrackSize.x:= form1.width;
ptMinTrackSize.y:= form1.height;
ptMaxTrackSize.y:= form1.height;
end;
end;
procedure TForm1.WMInitMenuPopup(var Msg: TWMInitMenuPopup);
begin
inherited;
if Msg.SystemMenu then
EnableMenuItem(Msg.MenuPopup, SC_SIZE, MF_BYCOMMAND or MF_GRAYED)
end;
procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
inherited;
with Msg do
if Result in [HTLEFT, HTRIGHT, HTBOTTOM, HTBOTTOMRIGHT,HTBOTTOMLEFT, HTTOP,HTTOPRIGHT, HTTOPLEFT] then
Result:= HTNOWHERE
end;
end.
Para ele permanecer na mesma posição coloque um Timer, coloque o interval:=1;
No OnTimer;
var
r : TRect;
osv : TOSVersionInfo;
begin
osv.EdwOSVersionInfoSize := sizeof(osv);
GetVersionEx(osv);
if osv.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then
begin
SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0);
Left := ((r.right - r.left) - Width) div 2;
Top := ((r.bottom - r.top) - Height) div 2;
end
else
begin
Left := (GetSystemMetrics(SM_CXSCREEN) - Width) div 2;
Top := (GetSystemMetrics(SM_CYSCREEN) - Height) div 2;
end;
end;
isso vai centralizar o form.
abraço
Diogo
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)