Files
qhmes/yy-admin-master/YY.Admin/Views/Dialogs/ServerSettingsDialogView.xaml.cs

34 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Windows.Controls;
using System.Windows;
namespace YY.Admin.Views.Dialogs
{
/// <summary>
/// ServerSettingsDialogView.xaml 的交互逻辑
/// </summary>
public partial class ServerSettingsDialogView : UserControl
{
public ServerSettingsDialogView()
{
InitializeComponent();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
var win = Window.GetWindow(this);
if (win == null) return;
// 必须先关闭 AllowsTransparency再改 WindowStyle否则会抛出
// 「当 AllowsTransparency 为 true 时WindowStyle.None 是唯一有效值」)
win.AllowsTransparency = false;
win.WindowStyle = WindowStyle.SingleBorderWindow;
win.ResizeMode = ResizeMode.CanResizeWithGrip;
win.SizeToContent = SizeToContent.Manual;
win.MinWidth = 520;
win.MinHeight = 420;
if (win.Width < 520) win.Width = 520;
if (win.Height < 420) win.Height = 420;
}
}
}