• Advertisement
Sign in to follow this  

[.net] how to get the runtime width and Height of a control

This topic is 4554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi everyone, i'm wondering how to get the runtime Height and Width of a control like a panel(dock:fill). i've tried the panel.height and panel.width, but they are the same as what i initialized after i maxmized the form.

Share this post


Link to post
Share on other sites
Advertisement
I can't reproduce it here (in .Net 1.1), I created a new Form, dropped a panel on it, and put the following lines in the constructor:

Console.WriteLine(this.panel1.Size.ToString());
this.panel1.Dock = Dockstyle.Fill;
Console.WriteLine(this.panel1.Size.ToString());

The output is:
{Width=336, Height=224}
{Width=960, Height=557}

So it works fine for me.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement