FOLLOW US
4dots Software CODE BLOG

How to Center any Control on the Form

To center horizontally any control on the form or on its parent control you can use the following :
	

	mycontrol.Left=mycontrol.Parent.Width/2-mycontrol.Width/2;	

To center vertically any control on the form or on its parent control you can use the following :
	
	
	mycontrol.Top=mycontrol.Parent.Height/2-mycontrol.Height/2;


 

Please Donate!

Please Share!