Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 5th, 2004, 10:36 AM
Registered User
Join Date: Nov 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting hold of Form size after maximizing

I have this class that inherits from System.Windows.Forms.Form. In the constructor it says:

this.WindowState = FormWindowState.Maximized;
other than thisi dont set any information about the size of the window. But when i request "this.Height" and "this.Width" both return 300 (for some reason). So i add the following lines:

this.Height = ClientRectangle.Height;
this.Width = ClientRectangle.Width;
now "this.Height" returns 266, and "this.Height" returns 292. Where did these numbers come from?

I'm trying to place various items on the screen after maximizing without setting the points explicitly, but i cant seem to get a hold of the windows actual size after maximizing it, how should i go about this?

Reply With Quote
  #2 (permalink)  
Old November 13th, 2004, 02:53 AM
Authorized User
Join Date: Jun 2003
Location: Glendale, California, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to HuhOiC

This is what I did and it worked perfectly for me.

        private void button1_Click(object sender, EventArgs e)
            this.WindowState = FormWindowState.Maximized;

            MessageBox.Show(this.Height + " x " + this.Width);

returned the appropriate window size. Can you show me your exact code?

Huh O i C

Program or Be Programmed!!!
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to hide MDI child Titlebar while Maximizing it Sachin Shinde Visual Studio 2005 0 June 8th, 2006 05:23 AM
maximum size of HTML form field crmpicco HTML Code Clinic 4 April 24th, 2006 05:14 AM
Form size dartcoach Access 4 February 4th, 2005 12:47 PM
{ and } to hold an array jaucourt VB.NET 2002/2003 Basics 2 November 25th, 2004 09:15 AM
datatype to hold 3000 chars mikeuk PHP Databases 8 July 20th, 2004 10:18 AM

All times are GMT -4. The time now is 04:15 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.