Hi Rolf,
I have performed a test based on your description and did reproduce the
problem. When the Windows is set to 96dpi, I add an instance of the
UserControl on the form at design time. Then I change the setting to 120dpi
and restart the machine. Under the 120dpi mode, the usercontrol added at
design time becomes larger. However, the usercontrol I add at run time is
as big as it was at 96dpi.
When the program is run at 120dpi mode, the form is auto scaled by Windows
operation system. Before the form is auto scaled, the usercontrol that is
added on the form at design time has already exists on the form (the
initialize code of this usercontrol is within the InitializeComponent
method and the InitializeComponent method is called in the form's
constructor). So this usercontrol will be auto scaled with the form as
well. On the contrary, the usercontrol that is added later at run time
won't be auto scaled.
As a workaround, I recommend you to set the AutoScale property of the form
to False. Thus, the form won't be auto scaled at 120dpi mode as well as the
usercontrol on the form.
Hope this helps.
If my suggestion doesn't apply to your scenario or you have anything
unclear, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.