Centre fame contained within a form in vb.net

Hi,

I have a form called frmMaster and a frame called fraCover on the form. I am trying to find out how I centre the frame on the form in code please.

Many Thank
Lee
ljhodgettAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
Lee,

Try this:

Dim x As Integer = (Me.ClientSize.Width - fraCover.Width) \ 2
Dim y As Integer = (Me.ClientSize.Height - fraCover.Height) \ 2
fraCover.Location = New Point(x, y)

Bob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.