aewarnick Posted March 30, 2003 Posted March 30, 2003 MessageBox.Show(this.RTB1.Location.X+" "+this.RTB1.Location.Y+"\n"+this.RTB1.Location); I want to use Cursor.Clip() but I cannot because the location is never right. . . That text box is not near point 0 0 but it always shows that it is, why? Quote C#
Moderators Robby Posted March 30, 2003 Moderators Posted March 30, 2003 Is it inside a Control Box or Panel? If so, the location is relative to its' parent control. Quote Visit...Bassic Software
aewarnick Posted March 30, 2003 Author Posted March 30, 2003 It is in a panel. That is the problem. Thank you, I did not know that. Quote C#
aewarnick Posted March 30, 2003 Author Posted March 30, 2003 Ok, same problem exept more weird. Cursor.Position=new Point(saveButton.Location.X, saveButton.Location.Y); That should put the cursor right on the upper left corner of the button but instead, no matter what object I put it on it is always about 20 pixels above where it needs to be and those are objects that are directly on the form, no panels. I had the same problem with the paneled objects, I figured out how to get the point of a text box relative to the panles but it is always about 20 pixels above where it needs to be. Quote C#
*Experts* Volte Posted March 30, 2003 *Experts* Posted March 30, 2003 Use the myButton.PointToScreen(myButton.Location) to get the location of the button on the screen, rather than relative to the form. Quote
aewarnick Posted March 30, 2003 Author Posted March 30, 2003 Cursor.Position= this.ExpandedViewB.PointToScreen(this.ExpandedViewB.Location); If I did that right it is even worse than before. Any idea what is going on? I even tried it on a much less complicated form. Quote C#
*Gurus* divil Posted March 31, 2003 *Gurus* Posted March 31, 2003 If you want to position the cursor on the top-left corner of a button on your form, use this: Cursor.Position = Button3.Parent.PointToScreen(Button3.Location); Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
aewarnick Posted March 31, 2003 Author Posted March 31, 2003 That works perfectly, but what was the other one for? Quote C#
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.