RE: 120dpi setting for windows and dynamic added controls

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • RE: Using BackgroundWorker in a browsers hosted user control
    ... Copy the code in the MSDN sample for BackgroundWorker component (you may ... This ensures the usercontrol hosted in the web page to be loaded ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.clr)
  • RE: Best way to access Inherited Methods
    ... How do I use Reflection to switch to the different Inherited Types ie ... public class MyUserControl1: UserControl, IMyInterface ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: WebBrowser Problems in Thread
    ... I set up a Windows application project and create a usercontrol. ... When I click button1, the webbrowser ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • RE: Delegate for control embedded into MFC
    ... Control Library project and a UserControl in this project. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • RE: Event not firing. User control with a repeater that contains a bu
    ... and another is dynamically loaded into a MultiView in the first ... programmatically add nested usercontrol into multiview: ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)