wpf 中获取鼠标坐标位置的方法

2018-06-20  本文已影响0人  West_Winds_Gone

Point pointToWindow = Mouse.GetPosition(this);

Point pointToScreen = PointToScreen(pointToWindow);

this.Xtext.Text = pointToScreen.X.ToString();

this.Ytext.Text = pointToScreen.Y.ToString();

用到的是这个方法    Visual.PointToScreen Method (Point)

参考:https://msdn.microsoft.com/en-us/library/system.windows.media.visual.pointtoscreen.aspx

上一篇下一篇

猜你喜欢

热点阅读