King Chan
King Chan

Reputation: 4302

How to get Button location of the screen?

As titled, I want to make my application more user friendly by moving the mouse to the OK or Cancel button automatically (I got got affected some game...).

I know first thing I need is get the MainWindow application location, then + the location of the Button.

But how to do I get the location if the button is inside a Grid not Canvas? And if the Button is contains inside another control?

Upvotes: 0

Views: 2588

Answers (1)

brano
brano

Reputation: 2870

If you have the Button b You could use b.PointToScreen(..) to get a specific point on the button into screen coordinates.

Upvotes: 2

Related Questions