Skip to content

Commit 42f1b57

Browse files
committed
- Change Setting Window Size to responsive
1 parent 15266f2 commit 42f1b57

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Flow.Launcher/SettingWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
1515
Title="{DynamicResource flowlauncher_settings}"
1616
Width="1000"
17-
Height="700"
17+
Height="650"
1818
MinWidth="900"
1919
MinHeight="600"
2020
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}"

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Flow.Launcher.Helper;
1616
using System.Windows.Controls;
1717
using Flow.Launcher.Core.ExternalPlugins;
18+
using Screen = System.Windows.Forms.Screen;
1819

1920
namespace Flow.Launcher
2021
{
@@ -44,6 +45,15 @@ private void OnLoaded(object sender, RoutedEventArgs e)
4445
HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
4546
HwndTarget hwndTarget = hwndSource.CompositionTarget;
4647
hwndTarget.RenderMode = RenderMode.SoftwareOnly;
48+
49+
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
50+
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y);
51+
var dip2 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height);
52+
var workingHeight = dip2.Y * 0.8;
53+
var top = (dip2.Y / 2) - (workingHeight / 2);
54+
this.Height = workingHeight;
55+
this.Top = top;
56+
4757
}
4858

4959
private void OnAutoStartupChecked(object sender, RoutedEventArgs e)

0 commit comments

Comments
 (0)