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

前端 未结 5 703
深忆病人
深忆病人 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-08 00:04

    The exception may occur because a visual is discarded but still in memory due to a memory leak.

    I was having a similar problem. I found the exception occurring in a visual which was supposed to be garbage collected. Fixing the memory leaks in the visual solved the problem.

提交回复
热议问题