🔀 禁用窗口最大化

This commit is contained in:
BookerLiu
2023-04-23 20:58:12 +08:00
parent 2df6582f83
commit ac8302280f
9 changed files with 31 additions and 4 deletions

View File

@@ -7,6 +7,7 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
WindowStyle="None"
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent"
KeyDown="OnKeyDown"

View File

@@ -6,6 +6,7 @@
WindowStyle="None"
AllowsTransparency="True"
Background="Black"
ResizeMode="NoResize"
PreviewMouseMove="Window_PreviewMouseMove"
MouseLeftButtonDown="Window_MouseLeftButtonDown"
MouseRightButtonDown="Window_MouseRightButtonDown"

View File

@@ -12,6 +12,7 @@
Width="510"
WindowStyle="None"
Title=""
ResizeMode="NoResize"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"

View File

@@ -10,6 +10,7 @@
Height="550"
Width="1000"
Title="Task"
ResizeMode="NoResize"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"

View File

@@ -10,6 +10,7 @@
WindowStyle="None"
AllowsTransparency="True"
Title=""
ResizeMode="NoResize"
Background="Transparent" ShowInTaskbar="False"
Focusable="True"
KeyDown="OnKeyDown">

View File

@@ -29,6 +29,7 @@
MouseEnter="MainWindow_MouseEnter"
GotFocus="Window_GotFocus"
Loaded="Window_Loaded"
SourceInitialized="Window_SourceInitialized"
Topmost="{Binding AppConfig.AlwaysTopmost}"
>
@@ -42,7 +43,7 @@
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="15"/>
<WindowChrome CaptionHeight="0" CornerRadius="30" ResizeBorderThickness="23"/>
</WindowChrome.WindowChrome>
<Window.InputBindings>

View File

@@ -50,6 +50,8 @@ namespace GeekDesk
public static int colorPickerHotKeyId = -1;
public static MainWindow mainWindow;
private static bool dataFileExist = true;
public MainWindow()
{
@@ -57,6 +59,7 @@ namespace GeekDesk
//加载数据
LoadData();
InitializeComponent();
//用于其他类访问
mainWindow = this;
@@ -72,8 +75,11 @@ namespace GeekDesk
}
private void Window_SourceInitialized(object sender, EventArgs e)
{
//禁用窗口最大化
WindowUtil.DisableMaxWindow(this);
}

View File

@@ -2,7 +2,7 @@
"title": "GeekDesk版本更新",
"subTitle": "V2.5.14",
"msgTitle": "本次更新内容如下",
"msg": "['好久不见, 别来无恙, 辞职回老家了, 突然换了新环境有点不适应, 目前还处于工作中的迷茫期, 祝我们大家都前程似锦', '另外GeekDesk准备冲击一下Gitee GVP, 希望大家能给我点一下码云(Gitee)和GitHub的star❤❤❤', '之后我会抽时间编写一下开发者文档, 方便大家更清楚的了解项目结构, 从而有更多的人参与进来开发(一直没有编写是因为太懒了), 不多说了, 看下这次更新内容吧', '集成Everything搜索,设置-->其它-->勾选Everything插件开启', '增加了关联文件夹功能, 右键点击左侧栏-->新建关联菜单', '增加强制置顶开关,设置-->显示设置-->勾选/取消 置于顶层', '右侧栏图标列表增加了自适应列宽, 不会出现图标显示一半的情况了', '简单添加了新手引导提示', '加密菜单bug修复 By @1062406901', '多显示器拾色器bug修复 By @1062406901', '拖动图标到菜单的异常修复 By @Hsxxxxxx', '优化部分UI', '其它bug修复及功能优化']",
"msg": "['好久不见, 别来无恙, 辞职回老家了, 突然换了新环境有点不适应, 目前还处于工作中的迷茫期, 祝我们大家都前程似锦', 'GeekDesk准备冲击一下Gitee GVP, 希望大家能给我点一下码云(Gitee)和GitHub的star❤❤❤', '之后我会抽时间编写一下开发者文档, 方便大家更清楚的了解项目结构, 从而有更多的人参与进来开发(一直没有编写是因为太懒了), 不多说了, 看下这次更新内容吧', '集成Everything搜索,设置-->其它-->勾选Everything插件开启', '增加了关联文件夹功能, 右键点击左侧栏-->新建关联菜单', '增加强制置顶开关,设置-->显示设置-->勾选/取消 置于顶层', '右侧栏图标列表增加了自适应列宽, 不会出现图标显示一半的情况了', '简单添加了新手引导提示', '加密菜单bug修复 By @1062406901', '多显示器拾色器bug修复 By @1062406901', '拖动图标到菜单的异常修复 By @Hsxxxxxx', '优化部分UI', '其它bug修复及功能优化']",
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
"statisticUrl": "http://43.138.23.39:8989/bookerService/geekDeskController/userCountStatistic",

View File

@@ -63,6 +63,21 @@ namespace GeekDesk.Util
[DllImport("user32.dll")]
static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_STYLE = -16;
private const int WS_MAXIMIZEBOX = 0x10000;
public static void DisableMaxWindow(Window window)
{
var hwnd = new WindowInteropHelper(window).Handle;
var value = GetWindowLong(hwnd, GWL_STYLE);
SetWindowLong(hwnd, GWL_STYLE, (int)(value & ~WS_MAXIMIZEBOX));
}
public static void SetOwner(Window window, Window parentWindow)
{