コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: Msg.xaml.cs プロジェクト: wuxingya/Wox
        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;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: pengjinfei/Wox
        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);
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: pengjinfei/Wox
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }