Board index » delphi » setting the size of maximized windows

setting the size of maximized windows

Hi

if the user clicks the maximize button of a window, it
covers the whole area of the screen. I would like to
reduce this size such that my application stays visible.

Is there an API call to set the size of maximized
windows.

  Thanks for any hints

  Matthias Mueller (mailto://mat...@mail.com)

 

Re:setting the size of maximized windows


Hi, my guess is that you want to keep your application always
visible, so nothing covers it. For that purpose, I would suggest
that you just change the FormStyle property of the form to
fsStayOnTop.

Hiween

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!

Re:setting the size of maximized windows


Can't remember where I got this from...

--
unit UnitMain;

interface

{
   This example show how you can specify the minimum and maximum sizes
   of a window, showing it directly to the user by blocking him during
   resize.
   It also shows predefined size and position of windows when
Maximizing it.

Quote
}

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
  StdCtrls, ExtCtrls;

type

  TfrmRestrictSize = class(TForm)
    Memo1: TMemo;
    Panel1: TPanel;
    Label1: TLabel;
    Label3: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    procedure FormShow(Sender: TObject);
    procedure FormResize(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure ShowSize;
    // You must handle the WM_GETMINMAXINFO message
    procedure RestrictSize(var msg: TMessage); message WM_GETMINMAXINFO;
  end;

var
  frmRestrictSize: TfrmRestrictSize;

implementation

{$R *.DFM}

procedure TfrmRestrictSize.ShowSize;
begin
   Label3.Caption := IntToStr(Width);
   Label4.Caption := IntToStr(Height);
end;

procedure TfrmRestrictSize.RestrictSize(var Msg: TMessage);
var
   p: PMinMaxInfo;
begin
// The lParam contains a pointer on a structure of type TMinMaxInfo
   p := PMinMaxInfo(Msg.lParam);
// This represents the size of the Window when Maximized
   p.ptMaxSize.x := 320;
   p.ptMaxSize.y := 240;
// This represents the position of the Window when Maximized
   p.ptMaxPosition.x := 10;
   p.ptMaxPosition.y := 10;
// This represents the minimum size of the Window
   p.ptMinTrackSize.x := 320;
   p.ptMinTrackSize.y := 240;
// This represents the maximum size of the Window
   p.ptMaxTrackSize.x := 400;
   p.ptMaxTrackSize.y := 320;
end;

procedure TfrmRestrictSize.FormShow(Sender: TObject);
begin
   ShowSize;
end;

procedure TfrmRestrictSize.FormResize(Sender: TObject);
begin
   ShowSize;
end;

end.

--

In article <38B80AEB.848E6...@graphics.lcs.mit.edu>,
  Matthias Mueller <muel...@graphics.lcs.mit.edu> wrote:

Quote
> Hi

> if the user clicks the maximize button of a window, it
> covers the whole area of the screen. I would like to
> reduce this size such that my application stays visible.

> Is there an API call to set the size of maximized
> windows.

>   Thanks for any hints

>   Matthias Mueller (mailto://mat...@mail.com)

--
DIGITAL PROSPERITY PTY LTD  phone: +61 3 9761-3885
P.O. Box 557                fax:   +61 3 9761-3811
Boronia, Victoria 3155
http://www.luck-e-lotto.com.au

Sent via Deja.com http://www.deja.com/
Before you buy.

Other Threads