L lul New member Joined Mar 7, 2009 Messages 4 Programming Experience 1-3 Mar 7, 2009 #1 hi to all. i want the panel to center itself evertime i change the size of the window. how do i do it? panel1.location.x=form1.location.x doesent work.
hi to all. i want the panel to center itself evertime i change the size of the window. how do i do it? panel1.location.x=form1.location.x doesent work.
JuggaloBrotha VB.NET Forum Moderator Staff member Joined Jun 3, 2004 Messages 4,530 Location Lansing, MI; USA Programming Experience 10+ Mar 7, 2009 #2 Short and simple you want to take half of the form's width and subtract half of the panel's width to center it horizontally, same for vertically VB.NET: Panel1.Location = New Point((Me.Width / 2) - (Panel1.Width / 2), (Me.Height / 2) - (Panel1.Height / 2)) Upvote 0 Downvote
Short and simple you want to take half of the form's width and subtract half of the panel's width to center it horizontally, same for vertically VB.NET: Panel1.Location = New Point((Me.Width / 2) - (Panel1.Width / 2), (Me.Height / 2) - (Panel1.Height / 2))