0

I have an application written in vb.net which works fine in both Windows XP, Vista and 7. However, in Windows Vista and 7, the button layout (specifically the Exit/Cancel button at the bottom right) of all the forms acts weird, as the Exit/Cancel button runs all the way touching the edge/boundary of the form as shown in the pic below.

enter image description here

This does not happen in Windows XP. Nor does it happen on disabling the Visual Styles in Windows 7, as shown below

enter image description here

What can be the cause for this issue and is there any way to solve this, so that it looks good for both XP and Windows 7?

EDIT: I'm posting this on behalf of a friend - Abhijit (https://stackoverflow.com/users/2642426/abhijit-hota) - who wanted to post this himself but had less than 10 reputation. Apparantly you need to have at least 10 reputation to post a question with an image.

Community
  • 1
  • 1
Onkar
  • 159
  • 1
  • 4
  • My crystal ball says that this form inherits from a base form class that actually has the buttons and that they are anchored to the bottom+right. Details like this are not anything you can ever skip in a question. – Hans Passant Oct 03 '13 at 12:04

1 Answers1

0

One way to fix it is the place the buttons in a TableLayoutPanel. Then you can

  1. Move it a bit further from the edge
  2. Or leave an extra column on the right as a margin or gutter
  3. Or anchor it in a way (left maybe) to prevent it

Another possible cause is that the controls are not using the Anchor property and he has tried to neatly line them up with something as an absolute position (which Visual Stlyes messes up as relative sizes and text extent changes). Any given user may or may not be using Styles Anchors so a layout panel works well to neaten things up.

Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178