- SendMessage(GetHwnd(), SB_SETMINHEIGHT, height + 2*GetBorderY(), 0);
+ // It looks like we need to count the border twice to really make the
+ // controls taking exactly height pixels fully fit in the status bar:
+ // at least under Windows 7 the checkbox in the custom status bar of the
+ // statbar sample gets truncated otherwise.
+ height += 4*GetBorderY();
+
+ // We need to set the size and not the size to reflect the height because
+ // wxFrame uses our size and not the minimal size as it assumes that the
+ // size of a status bar never changes anyhow.
+ SetSize(-1, height);
+
+ SendMessage(GetHwnd(), SB_SETMINHEIGHT, height, 0);