Skip to main content
GameDev.net gamedev.net
🔒 Locked

[.net] Getting the absolute Control position without recursion?

Started by Roof Top Pew Wee Jun 3, 2006 at 4:26 PM 0 replies 1.1k views
Original Post
Roof Top Pew Wee
Roof Top Pew Wee
I am interested in finding the relative position of a cursor on a System.Windows.Forms.Control . Since I can get the absolute cursor screen cursor position, it'd be a piece of cake once I got the absolute Control position. Problem is it seems every property exposes only relative position, and since Controls can be many levels deep, and I will be testing this every frame in my game, is there any way to do it without stepping up the hierarchy recursively? That is, am I missing some property or method that returns the absolute position?
turnpast
turnpast
There are two handy methods in Control that may solve your problem: PointToClient() and PointToScreen() I hve no idea if it is recursive or not under the hood.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.