public Msg() { InitializeComponent(); var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); var dipWorkingArea = WindowIntelopHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, screen.WorkingArea.Height); Left = dipWorkingArea.X - Width; Top = dipWorkingArea.Y; showAnimation.From = dipWorkingArea.Y; showAnimation.To = dipWorkingArea.Y - Height; // Create the fade out storyboard fadeOutStoryboard.Completed += fadeOutStoryboard_Completed; DoubleAnimation fadeOutAnimation = new DoubleAnimation(dipWorkingArea.Y - Height, dipWorkingArea.Y, new Duration(TimeSpan.FromSeconds(1))) { AccelerationRatio = 0.2 }; Storyboard.SetTarget(fadeOutAnimation, this); Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(TopProperty)); fadeOutStoryboard.Children.Add(fadeOutAnimation); imgClose.Source = ImageLoader.Load(Path.Combine(Infrastructure.Wox.ProgramPath, "Images\\close.png")); imgClose.MouseUp += imgClose_MouseUp; }
public Msg() { InitializeComponent(); var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); var dipWorkingArea = WindowIntelopHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, screen.WorkingArea.Height); Left = dipWorkingArea.X - Width; Top = dipWorkingArea.Y; showAnimation.From = dipWorkingArea.Y; showAnimation.To = dipWorkingArea.Y - Height; // Create the fade out storyboard fadeOutStoryboard.Completed += fadeOutStoryboard_Completed; DoubleAnimation fadeOutAnimation = new DoubleAnimation(dipWorkingArea.Y - Height, dipWorkingArea.Y, new Duration(TimeSpan.FromSeconds(0.3))) { AccelerationRatio = 0.2 }; Storyboard.SetTarget(fadeOutAnimation, this); Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(TopProperty)); fadeOutStoryboard.Children.Add(fadeOutAnimation); imgClose.Source = new BitmapImage(new Uri("Images\\close.pn", UriKind.Relative)); //imgClose.Source = new BitmapImage(new Uri(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Images\\close.png"))); imgClose.MouseUp += imgClose_MouseUp; }
private double WindowTop() { var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); var dip1 = WindowIntelopHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y); var dip2 = WindowIntelopHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height); var top = (dip2.Y - QueryTextBox.ActualHeight) / 4 + dip1.Y; return(top); }
private double WindowLeft() { var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); var dip1 = WindowIntelopHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0); var dip2 = WindowIntelopHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, 0); var left = (dip2.X - ActualWidth) / 2 + dip1.X; return(left); }
private double GetWindowsTop() { if (UserSettingStorage.Instance.RememberLastLaunchLocation) { return(UserSettingStorage.Instance.WindowTop); } var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); var dipPoint = WindowIntelopHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height); UserSettingStorage.Instance.WindowTop = (dipPoint.Y - QueryTextBox.ActualHeight) / 4; return(UserSettingStorage.Instance.WindowTop); }
private double GetWindowsLeft() { if (UserSettingStorage.Instance.RememberLastLaunchLocation) { return(UserSettingStorage.Instance.WindowLeft); } var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); var dipPoint = WindowIntelopHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, 0); UserSettingStorage.Instance.WindowLeft = (dipPoint.X - ActualWidth) / 2; return(UserSettingStorage.Instance.WindowLeft); }
private double GetWindowsTop() { if (_settings.RememberLastLaunchLocation) { return(_settings.WindowTop); } var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); var dip1 = WindowIntelopHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y); var dip2 = WindowIntelopHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height); var top = (dip2.Y - ActualHeight) / 4 + dip1.Y; return(top); }
private double GetWindowsLeft() { if (_settings.RememberLastLaunchLocation) { return(_settings.WindowLeft); } var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); var dip1 = WindowIntelopHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0); var dip2 = WindowIntelopHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, 0); var left = (dip2.X - ActualWidth) / 2 + dip1.X; return(left); }