I have attached a screen shot : http://i.imgur.com/tU05T.png I have checked my DPI settings. they are 100%. I cant seem to find out why the test would be a differnt font size in the runtime application vs the designer.. Can anyone assist. I have tried googling, have have not come up with any meaningful links..
The two shoots use different fonts, so you can't expect the alignment to match. Perhaps Windows 7 substitutes your selected font for something else. Can you force the font to make sure the same is used in both cases?
Windows 7 uses Segoe UI as its default interface font. If you haven't explicitly set a font on your form or controls, that's what you're going to get.
This is not the case in previous versions of Windows, which used Microsoft Sans Serif. This is also what Visual Studio displays.
Edit: Although that source doesn't say that Windows will automatically set the font to Segoe UI, so I'm not really sure why it's changing. I'm not on a Windows 7 machine at the moment, so I can't see what my machine does.
To circumvent such issues with different fonts on different Windows versions, or to deal with environments where the user has specified to use large fonts, it is best to use a layout manager to dynamically resize your controls.
Specifying a certain font is not a good idea, because then the GUI will not match the platform standard and you cannot be certain that the font is present (Segoe UI is not available on Windows XP for example). In addition, it doesn't solve issues like large fonts (or different string lengths in localized versions).
In Windows Forms an automatically adjusting layout can be accomplished by using e.g. a TableLayoutPanel
. You will find a sample for that on MSDN:
Walkthrough: Arranging Controls on Windows Forms Using a TableLayoutPanel