If you have the snapping to grid option still on then it may be easier to manually edit the top and left coordinates of each control using the properties window. Because label controls have an Alignment property, which can be set to center, all the programmer needs to worry about is actually centralising the control with the form. This can quite literally be a moving target, windows can be resized. However, the form has a special Resize event which is used to deal with these situations. Set the Left property of the title label to 0 and then enter the following line in the form resize subroutine.
Sub Now run the program and try altering the width of the window.
The above code works perfectly for centring labels, but what about controls where the programmer does not want to change their width. The code works by setting the left property of the command button to equal half the width of the current form. To make it perfectly centralised, half the width of the command button itself will need to be subtracted as well. Although VB has in-built controls for textual buttons and buttons with graphics, both types are rectangular. One answer is to borrow the Click event of an Image control.