Link to home
Start Free TrialLog in
Avatar of dominicwong
dominicwong

asked on

Presentation, position of Controls in Winform were changed

Hi experts

My windows application software consists of many forms. In each form, there are text labels, textboxes, buttons, etc.

While I'd tried very hard to align the text labels and textboxes, I noticed that they were all moved when running in other people's PC. In some people's PC, the text labels overlap with the textboxes. Or, the button can't display fully the text of the button....

I wonder if it has anything to do with the font setting of the PC.
Or do I have to offset every Control with the screen coordinate. But it seems like it is more than coordinate issue as for example, a button can't display fully the text of the button.

Any idea and suggestion? Thanks in advance.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

The layout issues can depend on font DPI setting, or scale (Windows 7).  I prefer the flow layout or table layout of a web page, which is available for Windows Forms (TableLayoutPanel or FlowLayoutPanel).
Avatar of dominicwong
dominicwong

ASKER

I presume the font DPI setting and scale (in Windows 7) are outside the VS2008. As I can't predict what OS customers will be using, I can't do anything about them. Am I correct?

What about TableLayoutPanel? Does it mean if I put the Controls in it then every Control will remain where I defined them?
Font DPI and scale are Windows settings.  You could probably detect that, and auto-adjust, but you would have to write code for that.  The TableLayoutPanel is a control container that has row and column definitions.  Each element has different sizing options (percentage, absolute, auto).  It can get a little tricky, depending on the layout requirements.  If you know about web development, then you should have an idea about HTML tables, and how they are good for dynamic layout.  

You might be able to attach a .png screen shot, and I could give you possible layout ideas.
Thank you for your help.
I've included an example of the layout.

"label" and "label 1234" could be right-aligned in my PC; and same for the textboxes. But in other people's PC, they could become misaligned as the photo.

Same for the "checkbox1" and the combobox. In my PC, they could be well-spaced. But in other people's PC, they could become slightly overlapped.
example.JPG
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for your help.
Yes, it works very well albeit a bit "tedious" to adust each individual row height, the anchor of each Control.

I have another related issue but will ask it in another question:
https://www.experts-exchange.com/questions/27594846/Spacing-between-Treenodes-in-Treeview-varies-between-PC.html
Thank you for your help.