|
-
Mar 7th, 2009, 12:18 PM
#1
Thread Starter
New Member
Form moving
I know this is horridly easy. Trying to load a form when I click a button. Got that far. The new form comes up in an inconvient spot on my desktop, so I would like to open it and then immediately move it to the upper right of my screen. Question is, how? 
Jeff
-
Mar 7th, 2009, 12:21 PM
#2
Re: Form moving
Code:
Dim frm As New Form1() With { .Location = New Point(My.Computer.Screen.WorkingArea.Width - Me.Width, 0) }
frm.Show()
But you'll have to set the form's location mode to Manual in the designer for this to work.
-
Mar 7th, 2009, 12:21 PM
#3
Re: Form moving
vb Code:
FormX.Location = New Point(0,0)
-
Mar 7th, 2009, 12:34 PM
#4
Thread Starter
New Member
Re: Form moving
A little too new for that. I assume 'FormX' is replaced with the current form that I want moved? Also, does this go in the first form or the second? I click a button to bring up a new form(window).
Thanks.
-
Mar 7th, 2009, 12:43 PM
#5
Thread Starter
New Member
Re: Form moving
whew, okay, got to semi-work. This will put it at the top left. I need this at the top right. My desktop is 1920x1200. I assume that 0,0 is the coordinates that the upper left window will be placed at. So 1920 minus my window width should do it, if my assumptions are right. How do I find out my window width?
-
Mar 7th, 2009, 12:54 PM
#6
Re: Form moving
Yes, that's right... FormX is the form that needs to be moved. In case it is the current form you can use the Me keyword too.
To position it to the top right corner, you can use this:
vb.net Code:
Me.Location = New Point(SystemInformation.WorkingArea.Width - Me.Width, 0)
Last edited by Pradeep1210; Mar 7th, 2009 at 12:59 PM.
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
|