Saturday, 5 October 2013

General Programming Tip: Control Alignment on Different Resolutions

I'm going to throw a piece of advice out there, to professional developers, and it might be a piece of advice many don't stumble upon.

Aligning things on your screen... If you have a piece of software, which fills the screen, or has a known size today, don't align the labels or controls on it to just fit that screen, use tricks like dock, and flow layouts, and alignments to layout the screen for any resolution.  It'll take more time now, but if you are planning to support the software on multiple platforms, or for many years, then it'll all be worth while.

Today your screen might be 800x600, and your label plonked on it might sit nicely...


But tomorrow...



Its a higher resolution, and its off to one side... So how might we quickly get around this?  Well, with a single label, its easy enough, make it fit the width of the screen, set the alignment to center... and voila.


Your text will always sit right... and this is a two second job... other patterns to achieve this take longer, but think about it now, save yourself some time in the future!

No comments:

Post a Comment