Skip to content

Commit

Permalink
[winforms] Cope with small windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph Leckett authored and migueldeicaza committed Dec 11, 2010
1 parent 986e5a1 commit 6a0140e
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -1477,16 +1477,17 @@ private void CalculateScrollBars ()
// v_scroll to account for the height of h_scroll
if (h_scroll.Visible) {
v_scroll.Maximum = layout_ht + h_scroll.Height;
v_scroll.Height = client_area.Height - h_scroll.Height;
v_scroll.Height = client_area.Height > h_scroll.Height ? client_area.Height - h_scroll.Height : 0;
} else {
v_scroll.Maximum = layout_ht;
v_scroll.Height = client_area.Height;
}

if (view == View.Details) {
// Need to update Maximum if using LargeChange with value other than the visible area
v_scroll.LargeChange = v_scroll.Height - (header_control.Height + item_size.Height);
v_scroll.Maximum -= header_control.Height + item_size.Height;
int headerPlusOneItem = header_control.Height + item_size.Height;
v_scroll.LargeChange = v_scroll.Height > headerPlusOneItem ? v_scroll.Height - headerPlusOneItem : 0;
v_scroll.Maximum = v_scroll.Maximum > headerPlusOneItem ? v_scroll.Maximum - headerPlusOneItem : 0;
} else
v_scroll.LargeChange = v_scroll.Height;

Expand Down

0 comments on commit 6a0140e

Please sign in to comment.