There’s always an easy way making your mobile application aware of screen orientation changes without coding some hard math’s to update your control locations and sizes. A good example is setting the Control Anchor Property.
What does Anchor Property do?
Gets or sets the edges of the container to which a control is bound and determines how a control is resized with its parent.
Anchor does the job for you for updating the control location and size! But one little problem for Windows Mobile. The Form doesn’t resize correctly when the screen orientation has changed.
Now how are we going to fix it? With just 2 simple codes, the problem will be solved.
Form.Hide() and Form.Show() follows.
Here’s a little video demonstrating how the problem and how will the 2 simple code can fix it.
Now why Hide() and Show() method? These can be use to refresh the form layout. I was also trying to find some simplest way to do it, but looks like this methods is the simplest.
Download the sample code here
Download count:
Cheers!
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.