centering controls in form
hello guys
i have a problem
i have created one of my programs which is consisting of form , small form which has controls and buttons now if i maximuzie the form the buttons and contros will appear i the lift side of the form, my quation is how can i make the controls and buttons appear in the middle of the form when i maximize the form ??
thanks
Re: centering controls in form
Re: centering controls in form
thank you wizbang this exacally what i want but..
what i need some thing more i need my program to do the same but with out resizing the buttons, the buttons should stay the same but put them in the center
thanks again
Re: centering controls in form
To center a control horizontally, you can do this:
Code:
Private Sub Form_Resize()
Command1.Left = Me.Width \ 2 - Command1.Width \ 2
End Sub
Re: centering controls in form
wizbang
i have problem with the last code
the program that i have created is a calculator so when i write that code all of the buttons align in the same position, so what is the solution for that
thanks
Re: centering controls in form
An easy way would be to put the buttons in a frame, and just move that. You can set the BorderStyle to None if you don't want it to be seen.
Re: centering controls in form
wizbang it is a good idea
but how can i move the buttons along with the frame , or how can i attach the buttons to the frame so they will move along
thanks
Re: centering controls in form
You can select all the buttons that you want to put in the frame, and select Cut from the Edit menu. Then select the frame, and Paste them in.
Re: centering controls in form
wizbang thank you very much for helping
it worked fine
:)