there are two things i need to do to my program.

1) centre the form on the screen, then make it full screen. so thatthe form is always in the centre disgregarding the size.

2) centre list/combo items. currently they are justified left, i need it so they are in the centre.

are there any ways to do these things?

If You are making it full screen, it is taking the entire screen area. So there's obviously no need to centre it. For Non Full-screen forms, in the form Load event write

me.left = (Screen.width - me.width)/2
me.top = (screen.height - me.height)/2


As far as I know, there's no way to centre align combo or listboxes.

If You are making it full screen, it is taking the entire screen area. So there's obviously no need to centre it. For Non Full-screen forms, in the form Load event write

me.left = (Screen.width - me.width)/2
me.top = (screen.height - me.height)/2


As far as I know, there's no way to centre align combo or listboxes.

well even in full screen, i would like all the objects in the centre of the screen.

I am not sure I am getting it. Do you want the form in the centre of the screen or the controls in the centre of the form ?

i want the form full screen, but the objects (textbox, labels, buttons etc etc) in the centre.

You can design the form with the controls in the centre. If you don't want the user to resize the form, you can disable the Min and Max buttons of the form.

Alternately if you want the controls to reposition themselves if the form is resized, you can use the form_resize event to write something like this

text1.left = (form1.width - text1.width)/2
text1.top = (form1.height - text1.height)/2

If there are several controls, you have to consider their relative positions also to adjust the left and top properties.

You can design the form with the controls in the centre. If you don't want the user to resize the form, you can disable the Min and Max buttons of the form.

Alternately if you want the controls to reposition themselves if the form is resized, you can use the form_resize event to write something like this

text1.left = (form1.width - text1.width)/2
text1.top = (form1.height - text1.height)/2

If there are several controls, you have to consider their relative positions also to adjust the left and top properties.

oh ok, thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.