Sign in to follow this  
billconan

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this