diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs
index 06ef7e3f6f..f6e00b73d7 100644
--- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs
+++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs
@@ -56,6 +56,7 @@ namespace MaaWpfGui.Constants
public const string CustomCulture = "GUI.CustomCulture";
public const string BackgroundImagePath = "GUI.Background.ImagePath";
+ public const string BackgroundImageStretchMode = "GUI.Background.StretchMode";
public const string BackgroundOpacity = "GUI.Background.Opacity";
public const string BackgroundBlurEffectRadius = "GUI.Background.BlurEffectRadius";
diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml
index e3d72b1968..64cd72bd5b 100644
--- a/src/MaaWpfGui/Res/Localizations/en-us.xaml
+++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml
@@ -18,6 +18,11 @@
Background Image
Background Opacity
Background Blur Radius
+ Background Stretch Mode
+ None
+ Fill
+ Uniform (Fit)
+ Uniform to Fill (Cover)
UI Theme
HotKeys
Update
diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
index 760490fd8e..1193328d62 100644
--- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
+++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
@@ -18,6 +18,11 @@
背景画像
背景の不透明度
背景のぼかし半径
+ 背景画像の伸縮モード
+ 伸縮なし
+ 引き伸ばし(フィル)
+ アスペクト比保持(フィット)
+ アスペクト比保持(トリミング)
UI主題
ホットキー設定
アップデート設定
diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
index ba9b5901f6..5a4f3ecd03 100644
--- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
+++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
@@ -19,6 +19,11 @@
배경 이미지
배경 불투명도
배경 흐림 반경
+ 배경 이미지 채우기 모드
+ 늘리지 않음
+ 늘려 채움
+ 비율 유지 (맞춤)
+ 비율 유지 (자르기)
단축키 설정
업데이트
정보
diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
index b1ce625e30..653c68c7f7 100644
--- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
+++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
@@ -18,6 +18,11 @@
背景图片
背景不透明度
背景模糊半径
+ 背景填充模式
+ 无拉伸
+ 拉伸填充
+ 等比适应
+ 等比填充(裁剪)
界面主题
热键设置
更新设置
diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
index 20a716c4ee..bafff33a8d 100644
--- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
+++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
@@ -18,6 +18,11 @@
背景圖片
背景不透明度
背景模糊半徑
+ 背景填充模式
+ 無拉伸
+ 拉伸填充
+ 等比適應
+ 等比填充(裁剪)
介面主題
熱鍵設定
更新設定
diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/BackgroundSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/BackgroundSettingsUserControlModel.cs
index 93934b7e73..7fa77ec972 100644
--- a/src/MaaWpfGui/ViewModels/UserControl/Settings/BackgroundSettingsUserControlModel.cs
+++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/BackgroundSettingsUserControlModel.cs
@@ -13,12 +13,16 @@
#nullable enable
using System;
+using System.Collections.Generic;
using System.Globalization;
using System.IO;
+using System.Linq;
using System.Windows.Input;
+using System.Windows.Media;
using System.Windows.Media.Imaging;
using MaaWpfGui.Constants;
using MaaWpfGui.Helper;
+using MaaWpfGui.Utilities.ValueType;
using Microsoft.Win32;
using Stylet;
@@ -70,6 +74,26 @@ public class BackgroundSettingsUserControlModel : PropertyChangedBase
}
}
+ private static Stretch _backgroundImageStretchMode = (Stretch)Enum.Parse(typeof(Stretch), ConfigurationHelper.GetGlobalValue(ConfigurationKeys.BackgroundImageStretchMode, Stretch.Fill.ToString()));
+
+ public Stretch BackgroundImageStretchMode
+ {
+ get => _backgroundImageStretchMode;
+ set
+ {
+ SetAndNotify(ref _backgroundImageStretchMode, value);
+ ConfigurationHelper.SetGlobalValue(ConfigurationKeys.BackgroundImageStretchMode, value.ToString());
+ }
+ }
+
+ public static List BackgroundImageStretchModeList { get; } =
+ [
+ new() { Display = LocalizationHelper.GetString("BackgroundImageStretchModeNone"), Value = Stretch.None.ToString() },
+ new() { Display = LocalizationHelper.GetString("BackgroundImageStretchModeFill"), Value = Stretch.Fill.ToString() },
+ new() { Display = LocalizationHelper.GetString("BackgroundImageStretchModeUniform"), Value = Stretch.Uniform.ToString() },
+ new() { Display = LocalizationHelper.GetString("BackgroundImageStretchModeUniformToFill"), Value = Stretch.UniformToFill.ToString() },
+ ];
+
private static BitmapImage? RefreshBackgroundImage(string imagePath)
{
if (string.IsNullOrEmpty(imagePath) || !File.Exists(imagePath))
diff --git a/src/MaaWpfGui/Views/UI/RootView.xaml b/src/MaaWpfGui/Views/UI/RootView.xaml
index 4c40f9c6bb..5b4fd5d901 100644
--- a/src/MaaWpfGui/Views/UI/RootView.xaml
+++ b/src/MaaWpfGui/Views/UI/RootView.xaml
@@ -66,12 +66,14 @@
+ Stretch="{c:Binding BackgroundImageStretchMode}">
diff --git a/src/MaaWpfGui/Views/UserControl/Settings/BackgroundSettings.xaml b/src/MaaWpfGui/Views/UserControl/Settings/BackgroundSettings.xaml
index 5c4a0f011f..7bb5811d05 100644
--- a/src/MaaWpfGui/Views/UserControl/Settings/BackgroundSettings.xaml
+++ b/src/MaaWpfGui/Views/UserControl/Settings/BackgroundSettings.xaml
@@ -64,5 +64,21 @@
+
+
+
+