|
-
Oct 24th, 2002, 10:41 AM
#1
Thread Starter
Addicted Member
Centering a form?
I don't see any centering property for a form, so I'm guessing that I'll have to use a code to do that.
In VB6, it was
VB Code:
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
but VB.Net doesn't seem to like it.
Could anyone please convert that VB6 code to VB.Net?
Thanks in advance.
-
Oct 24th, 2002, 10:46 AM
#2
Lively Member
StartPosition
On Developer Studio, select the form and change the property "StartPosition"
-
Oct 25th, 2002, 03:30 AM
#3
New Member
Can all be done with a property now but if you want to
do it the hard way then:-
Public Sub centerControl(ByRef c As Control)
c.Left = (Screen.PrimaryScreen.WorkingArea.Width - c.Width) / 2
c.Top = (Screen.PrimaryScreen.WorkingArea.Height - c.Height) / 2
c.Refresh()
End Sub
-
Oct 25th, 2002, 09:01 PM
#4
Member
Form has two Methods CenterParent and CenterScreen that can help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|