views:

1481

answers:

2

Hello!

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!

+1  A: 

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.

GenericTypeTea
Supose that I have a 240x320 form. This form has a button at point (4,245), if I flip it horizontally this button is out of the screen. In the form appears a scrollbar. I think, I have to change its origin point to display it, isn't it?
VansFannel
Set the anchor to "Bottom, Left" in the designer.
GenericTypeTea
A: 

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.

kgiannakakis
I've never noticed these different platforms handling anchors differently, but I have noticed that different devices has different DPIs which cause all sorts of anchoring issues.
GenericTypeTea