diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index e49465176..550b3e85d 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -14,7 +14,7 @@ xmlns:vm="clr-namespace:Flow.Launcher.ViewModel" Title="{DynamicResource flowlauncher_settings}" Width="1000" - Height="700" + Height="650" MinWidth="900" MinHeight="600" d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}" diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 203248ad6..0aa647146 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -15,6 +15,7 @@ using Flow.Launcher.ViewModel; using Flow.Launcher.Helper; using System.Windows.Controls; using Flow.Launcher.Core.ExternalPlugins; +using Screen = System.Windows.Forms.Screen; namespace Flow.Launcher { @@ -44,6 +45,15 @@ namespace Flow.Launcher HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource; HwndTarget hwndTarget = hwndSource.CompositionTarget; hwndTarget.RenderMode = RenderMode.SoftwareOnly; + + var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); + var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y); + var dip2 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height); + var workingHeight = dip2.Y * 0.8; + var top = (dip2.Y / 2) - (workingHeight / 2); + this.Height = workingHeight; + this.Top = top; + } private void OnAutoStartupChecked(object sender, RoutedEventArgs e)