Hi,
how can i get the desktop location of a control on a form i mean i want to know where my contol is on the desktop and not on the form....
thnx
Hi,
how can i get the desktop location of a control on a form i mean i want to know where my contol is on the desktop and not on the form....
thnx
contorl's desktop location
abowman
Each control has a property that is a Point called the Location. This location is relative to the Parent.
It also supports 2 methods. One of which is used here. PointToScreen. This method takes a Point that should be relative to it and then it converts it to screen coordinates.
Dim TmpPoint As Point = TreeView1.PointToScreen(new Point(0,0))
MessageBox.Show("X: " + TmpPoint.X.ToString() + " Y:" + TmpPoint.Y.ToString())
Probably the only thing that should be noted is people who are running multiple monitor systems tend to get confused as to why it's giving them seemingly bogus numbers because their interpretration of the desktop coordinates and window's interpretration based upon what monitor is your "primary" monitor" are often times differnet. Hope this helps. Let us know if you have any further questions .
Koas
Use the controls "PointToScreen" Method:
DesktopLocation = Me
.RichTextBox1.PointToScreen(Me.RichTextBox1.Location)Anne Carpenter
Hi Attila
I think that there is no code for it. but I suggest you this:
you can get the form position on desktop and control position on form, then plus them.
hope this help