What does everyone think about this?

The application I'm working on is run on a variety of different PCs, some XP, others not.

On PCs set up with XP Theme display the forms' caption bars are thicker, making the available space on the form smaller. Most of our forms were designed before XP so many of them end up with some of the controls almost falling off the bottom.

The following code appears to solve the problem, sizing the form appropriately for both XP and non-XP.

Can anyone think of any problems with this? Are there other display modes I haven't thought about?

The 405 value is the height of the title bar in Windows Classic. The height of the title bar in XP Themes is 510.

VB Code:
  1. Private Sub Form_Load()
  2.   Dim vDesiredHeight As Single
  3.   vDesiredHeight = 5000
  4.   Height = vDesiredHeight
  5.   Height = Height - 405 + (Height - ScaleHeight)
  6. End Sub