UI Changes Size When Installed on Another Computer - c#

I've had a reoccurring issue with my programs' UI: they look fine in design mode and when run on my computer but look different/incorrect (e.g. squished, overlapped controls) when run on other computers.
Any idea what this could be? At first I thought it might be a 32/64-bit issue but it wasn't.
Thanks!

Users can set their text size to be larger than normal, or choose a different font for controls.
Differing DPI settings can affect how things get laid out.

This can potentially be down to several issues.
DPI. Affects the layout of form controls (Thanks to Kristopher Johnson for this one!)
Theme. (Classic, Aero, Luna)...generally speaking Microsoft themes will not have much affect from one to another and neither will well designed custom themes, but badly designed custom themes will suffer. Again as described by Kristopher Johnson, Font size settings in the theme will impact how the form renders. - Consideration: lets say you run your app on a Linux installation of Mono...will it still look the same?
Fonts. If your application uses a font that the other machine does not have, then that machine will substitute it for another "fallback" font. This can have an effect in some controls, for example a label, where the width of the label scales to the width of the text of the given font.

There is a problem with Resolution.
Your machine has a different resolution than other machine, try to make design for resolution 1024X768

Related

Why does windows form resize on a different computer

I have a form that I have sized to what I wanted, it has a few panels, some buttons and some labels on it but when I open it on a different computer, it is resized and it is larger. I am using visual studio 2008. I know this is very little detail but I thought maybe someone knows of a known issue or some troubleshooting steps that I can take.
Possible reasons for this are different screen resolution and different DPI.
Several possible reasons. First and foremost is the form's AutoScaleMode property. The default, Font, ensures that both the font and the controls get resized to leave enough room for any displayed text. Text size is measured in points, 1/72 of an inch. If you run your program on a machine with a larger dots-per-inch setting for the video adapter, the fonts grow accordingly and need more pixels. That needs the controls to be bigger as well to prevent clipping the text.
Another reason is user preferences for border width (Aero) and caption bar height. A form is sized based on its designed ClientSize, the actual Size at runtime will be determined by adding those preferences to the design size. That's very rarely a problem.
May be the computers have different screen resolution and that's why it appears small in one and large on the other computer
Diffeent resolutions, different browsers, different versions. If you want o keep this from happening, you must specify their width and height.

Displaced controls in windows forms .net framework

I have a strange problem. I have designed a windows form application in c# and .net framework 3.5. In the runtime, the form and its controls are fine in all the computers except my laptop, where the controls are not in the correct positions.
If I design the form from scratch on my laptop with correct positioning it will result in an invalid shape for other computers.
My efforts:
If I run the windows in Safe Mode the form size and control positions
are correct.
I have uninstalled the Video Driver and used default windows version but the problem still persists.
I used different frameworks like 2.0 and 4.0, and different Visual Studios versions and they all have the same problems.
Actually all the .net framework product from all the companies indicate the same issue.
My computer Settings:
Laptop 1557 Studio DELL
Graphic ATI Radeon HD 4500
When the text size is artificially increased to 125% text and controls that are rather closely placed will wrap around the form and push everything down/over. If this is something you intend to support, you'll simply have to redesign your form to handle the different enlargement levels you care to support and test those enlarged text modes in your app until you're satisfied with their appearance. It's not something you can strictly control, since increased text size is an accessibility feature.
I assume it is due to a screen resolution differences. I believe that the actual location of the controls is identical in both cases, in one the screen is "larger" and therefor your controls appear in a different position on the screen.
try Designing forms to work on different resolutions and aspect ratios on Windows CE
Another thing you can (and should) do is work with WPF, which is the new way to build user interfaces for windows.
I've found a workaround just now.
In the display settings of Windows 7 I have changed the Text size from 125% to 100%. Everything is smaller but in accurate positions and sizes.
Still wondering how it works!!

What to do with a winforms app that looks poor with medium/large fonts enabled on windows 7?

I have a windows forms app built with .NET 3.5 and a relatively old version of Infragistics controls. It turns out some of the forms/controls look quite poor when viewed in Windows7 and Medium or Large Fonts. What are my options to resolve this? I have some tens of forms and would like a short-term solution rather than a rewrite, as the app will be migrated to WPF or Silverlight in the medium term.
Is there a switch I can 'turn off' medium/large fonts for the app as an immediate fix?
What general principles need to be followed for winforms apps to render nicely with medium/large fonts turned on?
So far the main things I've found I needed to do are:
Change forms/controls so AutoScaleMode is set to Font
Change any forms with programmatic resizing so they're dependent on other controls' size or position, rather than hard-coded numbers that are right if fonts are set to normal size.
Other than that things mostly work as desired. Mostly. Still the odd odd thing to track down.
+1 on the AutoScaleMode suggestion.
I redesigned all the forms into TableLayoutPanels (it took ages) and got set all my Labels to AutoResize = True. TableLayouts take most of the pain away. Scaling and alignment are a breeze, although they are quite slow compared to say WPF.

C# application GUI breaking on different Windows icon/text size settings

http://i.imgur.com/OXfC7.png
I have a c# form application that has a fixed size (cannot be resized) and cannot be maximized. Users who have a different setting for their icon/text sizes breaks my GUI (the entire form is bigger, background images start tiling, etc.
Help?
Microsoft recommends that a user change their DPI (dots per inch) settings and keep their native resolution rather than change the resolution to enlarge the visible display. This article also links to guides for building DPI aware applications.
http://msdn.microsoft.com/en-us/library/dd371771(VS.85).aspx
You should allow your forms and controls to scale, the user would most probably have changed their DPI settings for a reason. This reason is most probably related to accessibility and, as developers, we should strive to adhere to user interface and accessibility standards.
This usually increases the amount of work to create assets for web sites and applications. Also, thought should be put into the positioning of controls to ensure that they will not overlap or fall off the edge of the form when scaled. The best way to ensure that your application is compliant is to test at both ends of the spectrum and the normal recommended settings for usage.
As for disabling maximising of the form, this should only be done if you can ensure that the form will fit on the smallest of displays without issue. I have used applications on a netbook with a 7" screen that cannot be maximised, and they just don't fit, there is limited space to move the form around to access certain controls. If these could be maximised, I would then expect all controls to be visible, or can be able to scroll to reach them.
It is a challenge to develop a solution for all, but your end users will appreciate the work you have put in, if your application works correctly. Accessibility is a sensitive area and we should be making the effort to provide interfaces to cater for all users.
Well, sounds like you should allow it to be resized...
Quite frankly, even MS has gotten the hint and started changing most of their forms and even dialogs to be resizable. It's the friendly thing to do.
UPDATE:
A couple things come to mind on how to fix this. First, set the background image to Stretch. For the button, instead of using an image to display the text, just use a background image that has some transparency and use a regular font.
You should be a little more description of what you want. Since I'm not sure what you want to actually happen, you can prevent the form elements from resizing by changing your forms property AutoScaleMode to None.

Windows App Resolution

I have a windows app that runs correctly in my PC that is 96DPI but when I use it on a PC that has 120DPI the forms transform and all their components scramble.
How can I fix this?
Thanks.
It sounds like you need to use dynamic layout in your forms. You can use AutoSize, Docking/Anchoring, Padding, Margin, TableLayoutPanel, FlowLayoutPanel, etc, to structure your form so the actual positioning of your controls is done at run-time instead of compile-time. That way, your form will retain its layout even when the DPI is different. "Programming Microsoft Windows Forms" by Charles Petzold is a good book on Windows Forms. Chapter 3 of that book is full of information about how to use dynamic layout.
if you mean you have the source for the application (development question) you can check the DPI setting of the display the application is running on and re-format your interface as needed depending on the resolution.
If you mean that you have a compiled application from somewhere else and you don't have the source code for it you can set your resolution to 96 DPI.
Hope that helps.

Categories