- Change Setting Window Size to responsive

This commit is contained in:
DB p 2021-11-14 11:30:25 +09:00
parent 15266f2585
commit 42f1b57427
2 changed files with 11 additions and 1 deletions

View file

@ -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}"

View file

@ -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)