我有一个旧的Windows窗体应用程序,其中包含一个像工具提示一样的通知窗口,我正在更新wpf ..
我试图转换Windows窗体代码
this.Location = new Point(this.Location.X, this.Location.Y - 3);
if (this.Location.Y < Screen.PrimaryScreen.Bounds.Height - 190) {
Timer1.Stop();
Timer2.Start();
}
这是我在Wpf
中尝试过的var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
var transform = PresentationSource.FromVisual(this).CompositionTarget.TransformFromDevice;
var corner = transform.Transform(new Point(workingArea.Right, workingArea.Bottom));
this.Left = corner.X - this.ActualWidth;
this.Top = corner.Y;
if (this.Top < Screen.PrimaryScreen.Bounds.Height - 190) {
_timer1.Stop();
_timer2.Start();
}
我是Wpf的新手,我正在学习..感谢您的帮助。