Subject: Getting hold of Form size after maximizing
Posted By: Salte Post Date: 11/5/2004 9:36:45 AM
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 By: HuhOiC Reply Date: 11/13/2004 1:53:34 AM
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!!!

Go to topic 21360

Return to index page 717
Return to index page 716
Return to index page 715
Return to index page 714
Return to index page 713
Return to index page 712
Return to index page 711
Return to index page 710
Return to index page 709
Return to index page 708