Scaling controls (C#)

L

LR

I'm having problem scaling controls on the form. I have a form where
I'm adding my user control at design time. If I run at 96 dpi it looks
fine, all the controls inside my user control are sized and placed
correctly. As soon as I change font size to 120 dpi, the control and
all of it child controls are not looking right at design time.
Here's what happen when I run application:

1) If AutoScale of the form is set to true (at design time) and I'm
adding my control on the form load event, the control looks fine.
However, if I'll add control after form is loaded it doesn't look
right, all the controls inside of it are jammed.
2) If AutoScale of the form is set to false (at design time) and I'm
adding my control on the form load or after form is loaded it looks
the same as at design time – child controls look smaller and text
doesn't feet on the control's real-estate.

I would expect the controls to stay the same at 120 dpi as they were
at 96 dpi if AutoScale is set to false.

Can somebody help me with determining system current dpi and/or
rescale all the controls on the form based on current dpi.

Regards,
-Leo
 

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

Top