In WPF, under what circumstances does Visual.PointFromScreen throw InvalidOperationException?

前端 未结 5 664
深忆病人
深忆病人 2021-01-07 23:07

Suppose I wanted to do this, so I can find the current position of the mouse relative to a Visual, without needing access to a specific mouse event:

<         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-07 23:55

    I've found you can test IsVisible before calling PointFromScreen to protect against the InvalidOperationException.

提交回复
热议问题