Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting MDI client region size

504 views
Skip to first unread message

Ryan McGinty

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
I have a MDI main form with a few panels aligned to the side of it. Is
there anyway that I can get a rect of the main form's MDI client area?
Whenever I use the clientwidth and height, it includes the entire client
area of the main form, including the side panels. I just need the size of
the MDI window area only. Is there an API call or something? TIA

Ryan McGinty
rmcg...@oceris.com
OCERIS, Inc.
Home of FlexMedical


Andreas Vögerl

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
I think

var
R: TRect;
...
Windows.GetClientRect(ClientHandle, R);
...

should give you what you want...

R.Right = Width
R.Bottom = Height

"Ryan McGinty" <rmcg...@oceris.com> wrote in message
news:3999924b$1_2@dnews...

Ryan McGinty

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
Andreas,

Well, thanks for the suggestion, but that apparently is the same as the
ClientHeight and ClientWidth properties. It includes the area of the entire
form, not just the MDI area. But, again, thanks for the answer!

Ryan McGinty
rmcg...@oceris.com

"Andreas Vögerl" <NOSPAMandr...@gmx.net> wrote in message
news:8nc5q5$45...@bornews.borland.com...

> Windows.GetClientRect(ClientHandle, R);
> ...

Andreas Vögerl

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
I just tried it in a tiny sample app and with widths are not the same...

--------Uni1.pas--------

unit Unit1;

interface

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

type
TForm1 = class(TForm)
Label1: TLabel;
procedure FormResize(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormResize(Sender: TObject);
var
R: TRect;
begin
Windows.GetClientRect(ClientHandle, R);
Label1.Caption :=
Format('Form.ClientWidth=%d,'#13'MDIClient.ClientWidth=%d', [ClientWidth,
R.Right]);
end;

end.

----------------

--------Unit1.dfm--------

object Form1: TForm1
Left = 192
Top = 107
Width = 763
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsMDIForm
OldCreateOrder = False
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 0
Top = 0
Width = 249
Height = 453
Align = alLeft
Alignment = taCenter
AutoSize = False
Caption = 'Label1'
Layout = tlCenter
end
end

----------------

"Ryan McGinty" <rmcg...@oceris.com> wrote in message

news:3999a432$1_1@dnews...

Ryan McGinty

unread,
Aug 15, 2000, 3:00:00 AM8/15/00
to
Whoops! I didn't notice that you were passing ClientHandle. I was just
passing Handle. I just tried it and it works great! Thank you very much!

Ryan McGinty
rmcg...@oceris.com

"Andreas Vögerl" <NOSPAMandr...@gmx.net> wrote in message

news:8nc9cl$8s...@bornews.borland.com...

0 new messages