Forum > General

Runtime resizing of TForm

(1/2) > >>

epsilon:
Hi there.

I want to resize my Form1 at runtime. If I use the following code, it does nothing (width and height remain same as designed).

procedure TForm1.Form1Create(Sender: TObject);
begin
  with Form1 do
  begin
   BorderStyle:=bsSizeable;
   Width:=700;
   Height:=500;
  end;
end;

Help me, please.

Epsilon

Lightning:
Hmm, on what OS do you need it ?
On windows there are some API functions for it, on GTK this might not be verry easy though.

epsilon:

--- Quote from: "Lightning" ---Hmm, on what OS do you need it ?
On windows there are some API functions for it, on GTK this might not be verry easy though.
--- End quote ---
I have lazarus-0.9.4.1-20050103-win32.exe for windows.

Lightning:
Check this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/movewindow.asp
Pass the Handle of your form as HWND.

epsilon:

--- Quote from: "Lightning" ---Check this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/movewindow.asp
Pass the Handle of your form as HWND.
--- End quote ---
Sorry, but the following code does nothing:

procedure TForm1.Form1Create(Sender: TObject);
begin
 Form1.BorderStyle:=bsSizeable;
 Form1.Position:=poScreenCenter;
 MoveWindow(Form1.handle,10,10,900,700,true);
end;

Navigation

[0] Message Index

[#] Next page

Go to full version