开发者

Why can't I capture mouse in constructor

开发者 https://www.devze.com 2023-04-04 02:31 出处:网络
I have custom shape deriving from shape. Inside the constructor I want to capture t开发者_StackOverflow中文版he mouse, I cannot, I can only capture it once the shape has been created, does any one kno

I have custom shape deriving from shape. Inside the constructor I want to capture t开发者_StackOverflow中文版he mouse, I cannot, I can only capture it once the shape has been created, does any one know why, I would like to capture it inside the constructor?


If you need to create different Shapes depending upon the position or movement of the mouse cursor I would use the appropriate events of your Window or parent container to gather this information (e.g. to "capture" your mouse) and pass this information directly to the constructor or call an appropriate constructor of a certain subclass depending upon this information. There is no need to capture this info in constructor then.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号