Click here to Skip to main content
15,888,341 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
How do i make it know the location of each corner of my form?
Posted
Comments
[no name] 9-May-11 3:35am    
How do I make me know what you want?
Thomas Krojer 9-May-11 3:38am    
the question was clear
[no name] 9-May-11 3:41am    
Really? You do know what 'it' is, that's supposed to know a form's corners?

These are defined by Top, Bottom, Left, Right. For inner corners, use the same properties of the ClientRectangle, but remember it's int the different coordinates — relative to form's Location.

—SA
 
Share this answer
 
Comments
Espen Harlinn 9-May-11 16:49pm    
My 5 :)
Sergey Alexandrovich Kryukov 9-May-11 21:40pm    
Thank you, Espen.
--SA
I tried in this way:

C#
Point LocXY = this.Location;

MessageBox.Show("Top left corner location: " + LocXY.X + "," + LocXY.Y);
MessageBox.Show("Bottom Right corner location: " + (LocXY.X + this.Width) + "," + (LocXY.Y + this.Height));
MessageBox.Show("Bottom left corner location: " + LocXY.X + "," + (LocXY.Y + this.Height));
MessageBox.Show("Top right corner location: " + (LocXY.X + this.Width) + "," + LocXY.Y);


These message boxes are annoying but you can use the result in the way you like.

Hope it helped.
 
Share this answer
 
Comments
Espen Harlinn 9-May-11 16:49pm    
Nice effort, my 5
Tarun.K.S 10-May-11 2:32am    
Thanks!
Sergey Alexandrovich Kryukov 11-May-11 23:08pm    
Correct, 5.
--SA
Tarun.K.S 12-May-11 2:00am    
Thanks SA!
You can use the Location property of your form to get a Point containing the screen coordinates of the form.

Hope this helps
 
Share this answer
 
You can use the

Location<br />

and

Size

Properties.


The best would be you read this: http://msdn.microsoft.com/en-us/library/aa984420%28v=vs.71%29.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900