Was taking a look at a screen rotation (portrait to landscape and back) issue we were having in one of our soon to be released products when using the TabControl/TabPage.Height property and Compact Framework 2.0 and Windows Mobile 5.0.
When the screen orientation changed, the Form.Resize event is raised. Great, easy enough to adjust some ListViews that are in the TabPage using the following code:
listView2.Height = listView1.Height = (tabControl1.TabPages[0].Height / 2) - 2;
Although you think it would work, it doesn't because the TabPages[0].Height property is the Height before the Screen rotation occurs.
To work around this is easy enough, just use the Form.Height properties.
listView1.Height = listView2.Height = (this.Height - (20 * m_scale)) / 2;
where
Download the sample code here.
UPDATE: Got a comment here about using docking and anchoring which is true but for some reason was not working properly in our application, don't know why so we resorted to manually calculating sizes. I updated the sample code which shows the ListViews properly sizing using the Anchor property on rotation.
Powered by: newtelligence dasBlog 1.9.7174.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
E-mail
Theme design by Jelle Druyts