Label Text Character Width and Character Spacing Changes between VS IDE and Runtime

  • Thread starter Thread starter GTVic
  • Start date Start date
G

GTVic

Guest
Visual Studio 2012 running on Windows 10. I've added a label to my form with AutoSize turned off and 3 lines of text in it. At run-time the font has not changed, the text height has not changed but the width taken up changes. A screen capture comparison shows the text in the VS IDE has in general one less pixel between the letters and some letters are narrower. As a result at runtime the text is much wider and doesn't wrap to the next line as desired.

The original author of this code had all controls set for Arial which looked terrible so I reset to the default MS Sans Serif 8.25.

Side note, I am using a resizeable form with some controls anchored top left and some top right and some top left right which apparently causes some known issues with control movement. For example I have three columns of radio buttons that become ragged looking at runtime because some buttons move slightly from the IDE location left or right so I have code that loops through all my controls and re-sets the left property of radio buttons to a known value at runtime to fix the alignment. No other controls have this issue and only some of the radio controls move slightly. I'm not sure if these two issues are related.

Continue reading...
 
Back
Top