mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 03:37:10 +08:00
Messages should now display correctly on high dpi devices: now using Device Aware Pixels too.
This commit is contained in:
parent
83985aa44c
commit
66e00bb79a
@ -5,6 +5,7 @@ using System.Windows.Forms;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using Wox.Helper;
|
||||||
|
|
||||||
namespace Wox {
|
namespace Wox {
|
||||||
public partial class Msg : Window {
|
public partial class Msg : Window {
|
||||||
@ -13,15 +14,18 @@ namespace Wox {
|
|||||||
|
|
||||||
public Msg() {
|
public Msg() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||||
Left = Screen.PrimaryScreen.WorkingArea.Right - this.Width;
|
var dipWorkingArea = WindowIntelopHelper.TransformPixelsToDIP(this,
|
||||||
Top = Screen.PrimaryScreen.Bounds.Bottom;
|
screen.WorkingArea.Width,
|
||||||
showAnimation.From = Screen.PrimaryScreen.Bounds.Bottom;
|
screen.WorkingArea.Height);
|
||||||
showAnimation.To = Screen.PrimaryScreen.WorkingArea.Bottom - Height;
|
Left = dipWorkingArea.X - this.Width;
|
||||||
|
Top = dipWorkingArea.Y;
|
||||||
|
showAnimation.From = dipWorkingArea.Y;
|
||||||
|
showAnimation.To = dipWorkingArea.Y - Height;
|
||||||
|
|
||||||
// Create the fade out storyboard
|
// Create the fade out storyboard
|
||||||
fadeOutStoryboard.Completed += new EventHandler(fadeOutStoryboard_Completed);
|
fadeOutStoryboard.Completed += new EventHandler(fadeOutStoryboard_Completed);
|
||||||
DoubleAnimation fadeOutAnimation = new DoubleAnimation(Screen.PrimaryScreen.WorkingArea.Bottom - Height, Screen.PrimaryScreen.Bounds.Bottom, new Duration(TimeSpan.FromSeconds(0.3))) {
|
DoubleAnimation fadeOutAnimation = new DoubleAnimation(dipWorkingArea.Y - Height, dipWorkingArea.Y, new Duration(TimeSpan.FromSeconds(0.3))) {
|
||||||
AccelerationRatio = 0.2
|
AccelerationRatio = 0.2
|
||||||
};
|
};
|
||||||
Storyboard.SetTarget(fadeOutAnimation, this);
|
Storyboard.SetTarget(fadeOutAnimation, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user