Michael
Michael

Reputation: 13636

How resize Tab control programmatically?

I want programmatically resize tab Control on my winform.

tabCtrl.Size.Width = Convert.ToInt32(numericUpDown1.Value);
tabCtrl.Size.Height= Convert.ToInt32(numericUpDown2.Value);

But I get error:

Cannot modify the return value of 'System.Windows.Forms.Control.Size' because it is not a variable

Any idea how can I resize Tab control programmatically?

Upvotes: 1

Views: 2285

Answers (1)

bytecode77
bytecode77

Reputation: 14860

Use this. Note the (int) cast because NummericUpdown.Value is a decimal value.

tabCtrl.Size = new Size((int)numericUpDown1.Value, (int)numericUpDown2.Value);

Upvotes: 5

Related Questions