Hi everyone,

I have a panel which will be 'filled' with a form in runtime. My question is: how could I determine the size of the panel (becouse I want the form to change its size dinamically). thanks

Recommended Answers

All 4 Replies

Set your panel's Anchor property to Top,Bottom,Left,Right in the properties window so when you resize your form at the runtime your panel will be resized with your form consequently...

Set your panel's Anchor property to Top,Bottom,Left,Right in the properties window so when you resize your form at the runtime your panel will be resized with your form consequently...

Hi

It is not working in 2003 version because panel has no achor property plz tell me solution.
I am explaining my problem. Actually i want to call different forms into panel and panel size change at runtime according to different conditions and i want form's size also change according to panel size.

Thanks & Regards
Karuna

Try to use the following:
m_Panel.Dock = DockStyle.Fill;

As I understand you fill panel dynamically and you don't know exactly how much controls will be so you want to panel fit with size of controls and so with form, you have two options:
1: set panel scrollable and make it dock into form in fill mode.

2: you have to get size( width x height) of each control you add then resize form to required size where panel Dock option set into fill mode

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.