Control Padding...

  • Thread starter Thread starter Johnny Jörgensen
  • Start date Start date
J

Johnny Jörgensen

How do you set the Padding for a dynamically created control?

e.g.

Label myControl = new Label();
myControl.Padding.Left = 5;

Doesn't work. It says that System.Windows.Forms.Control.Padding is not a
variable....

/Johnny J.
 
Same as for any control:
myControl.Padding = new Padding(2,3,4,5); // ltrb
or
myControl.Padding = new Padding(5); // all

This oddity is because Padding is a value-type - I can explain more if
this doens't make sense...

Marc
 
No, it makes perfect sense now that you mention it - I could kick myself for
not thinking of it...

Thanks,
Johnny J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top