J. Vanbergen
J. Vanbergen

Reputation: 11

UserControl inside Panel inside UserControl not working

I am having some trouble creating the template of my application :

I am making some dynamic parts of forms and I use a panel in which I include my User Control according to the choice of the user. The panel has the same size as the user control but it doesn't work at runtime. The panel in which the UC is included is inside another UC also.

I tried autoSize = true, fixed size and many things but I don't know why it goes like this. Any idea?

Some parts of my code to load the User Control :

 UC_panel.Controls.Clear();
 UC_ADDRESS uca = new UC_ADDRESS();


 uca.Dock = DockStyle.Fill;
 uca.AutoSize = true;
 UC_panel.Controls.Add(uca);

My UserControl for the address

At runtime it goes bigger

Upvotes: 0

Views: 709

Answers (1)

Jimi
Jimi

Reputation: 32248

Since you set

uca.Dock = DockStyle.Fill;

and also

uca.AutoSize = true;

(which is redundant)

it is possible that some other container has its AutoScaleMode set to Font and its font size is bigger.

Upvotes: 1

Related Questions