0

In writing WinForms Apps in Visual Studio 2010, .NET, I often place a label on a form, set its AutoSize property to false and then drag it across a portion of the form. The label may contain 2 or more paragraphs, which I line up against the left side of the screen. Its Anchor property is set to Left, or Top, Left depending on where I place it on the form.

On my development machine (Windows 10) the label has the appearance that I desire. However, upon deploying it to another machine (whose monitor may have a different resolution) the text in the label is now shifted. A second or even third paragraph in the label no longer displays lined up against the left side of the form, but is spread out, as though I had tabbed the text to a different position.

My question is this: Is there anyway that I can prevent this behavior from occurring when deploying my App to another computer?

How can I get the deployed App to keep the label's text from shifting or spreading out?

CodeMann
  • 157
  • 9
  • Follow these notes: [How to configure an app to run correctly on a machine with a high DPI setting](https://stackoverflow.com/a/13228495/7444103) – Jimi Jan 12 '19 at 02:01
  • Hello Jimi. I tried the suggestion on that link, but after incorporating those changes and redeployment, the labels still appear skewed on the form. This same issue is affecting the height of my ListBoxes also. Even after setting the MaximumSize and MinimumSize properties, they shrink too small to be usable. NOTE: This is a ClickOnce deployment. – CodeMann Jan 12 '19 at 22:15
  • Could you post a screenshot and the resolution(s) on each machine? May be easier for others to help if they can recreate the issue. – Nathan Champion Jan 12 '19 at 22:49
  • The DPI setting can be different (you need to suppose it will be) and also the Font size can be scaled. I have no idea how your application handles DPI and Font size changes and the general setup of the Forms and their controls in relation DPI Awareness. You might find the application behaviour a bit awkward at first, if you haven't dealt with these presentation details before. I suggest to run the application on a test machine which has a different monitor than the production one. The overall behaviour may also depend on the System, VS and FW versions in use - use FW 4.7.1+, if possible. – Jimi Jan 13 '19 at 05:16
  • Hi Jimi. By FW, are you referring to .Net Framework? It's 4.0, which I install at deployment. I corrected my ListBox issue by setting the IntegralHeight property to false. This allowed the Max and MinSize properties to take effect after deployment. However, "Some" of my labels on my forms appear skewed, with the text appearing as though I had Tabbed them into different positions in the label. I could live with their display, but don't know how to account for end-user's monitor resolutions. BTW, my test system (Vista) is how I noticed the behavior in the first place. Dev is Win10 on VS2010. – CodeMann Jan 13 '19 at 16:15
  • Development machine Windows 10: 1600 x 900 Deployed PC Windows Vista: 1920 x 1080 – CodeMann Jan 13 '19 at 16:23

0 Answers0