Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 5th, 2004, 10:36 AM
Registered User
 
Join Date: Nov 2004
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:

Code:
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:

Code:
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?

 
Old November 13th, 2004, 02:53 AM
Authorized User
 
Join Date: Jun 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to HuhOiC
Default

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?

RAyRAy
Huh O i C

Program or Be Programmed!!!





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





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