Question

I want to deveplop an app for Windows Mobile 5.0 and above that can detect screen resolution and orientation. This part is easy, I know how to do it. The other part, reallocate controls process, is more difficult for me (not very difficult).

I wonder if there is a design pattern or a design guideline about how to do this process of moving controls depending on form size. I don't want to use any other framework that can do it. I want to do it by myselft.

Any suggestions?

Thank you!

Was it helpful?

Solution

The key to this is anchoring and docking.

Design the form for one screen resolution, I'd recommend you design for 240x320 and set your anchoring up correctly. Then when you flip it horizontally, the controls will automatically reposition.

The only time I've physically written code to handle this is when I've got a number of buttons within an ImageButton menu that auto space themselves when the screen resolution is flipped.

OTHER TIPS

You should start by anchoring your controls. This will have the controls relocated/resized when the orientation and the resolution changes. Most of the things you will find about Anchor and Dock in standard Windows Forms also apply to Compact Framework. However, you need to do intensive testing both with the emulators and real devices.

I have found that different platforms and windows mobile versions (Smartphone - Pocket PC, WM5 - WM6) treat the anchor tags somehow differently.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top