Form size question...

G

GTi

I have a resizeable form (window) and some controls inside.
When the form resizes I want the controls to follow.
So I use this.panel1.Move to handle the event.
But I need to know the size if the working area of the form.
I have a app. bar, menu and a Status Panel.
I know that this.Height-75 will give me the correct working height,
but this look ugly. What when the user use another app. bar height.

Is there another class to get the correct height AND width of the working
area in a form?
 
C

Carlos J. Quintero [.NET MVP]

You have the Size and ClientSize properties... :

private void Form1_Load(object sender, System.EventArgs e)
{
MessageBox.Show(this.Size.ToString());
MessageBox.Show(this.ClientSize.ToString());
}

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
A

Alan Pretre

GTi said:
Is there another class to get the correct height AND width of the working
area in a form?

Can't you use the Anchor settings? WinForms will resize or reposition the
controls for you.

-- Alan
 
G

GTi

Alan Pretre said:
Can't you use the Anchor settings? WinForms will resize or reposition the
controls for you.

-- Alan

Hi Alan,
After playing around with the Anchor settings,
it seems that it is exactly what I want.
Removing the left settings did it.

Thanks!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top