如何?WPF 窗口 - 最大化,不调整大小/移动 [英] How to? WPF Window - Maximized, No Resize/Move

查看:38
本文介绍了如何?WPF 窗口 - 最大化,不调整大小/移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个已经最大化打开的 WPF 窗口,没有调整大小/移动(在系统菜单中,也没有在边框中).它应该一直最大化,除非用户最小化它.

I'm trying to make a WPF window that opens already maximized, with no resize/move (in systemmenu, nor in border). It should be maximized all the time, except when the user minimize it.

我尝试将 WindowState="Maximized" 和 ResizeMode="CanMinimize",但是当窗口打开时,它覆盖了任务栏(我不想要它).

I tried to put WindowState="Maximized" and ResizeMode="CanMinimize", but when window opens, it covers the task bar (i don't want it).

我有一个到 WndProc 的钩子,可以取消 SC_MOVE 和 SC_SIZE.我还可以使用 WndProc 中的条件进行此控制,例如如果命令是还原并最小化,还原,否则,阻止"等.

I have an hook to WndProc that cancels the SC_MOVE and SC_SIZE. I also can make this control with conditions in WndProc like "if command is restore and is minimized, restore, else, block" and so on.

但我的观点是我们是否有另一种方式来实现.谢谢你们的阅读 =)

But my point is if we have another way to make it. Thankz for read guys =)

推荐答案

有必要在你的窗口的 xaml 中编写 WindowState="Maximized" ResizeMode="NoResize" :

It is necessary to write WindowState="Maximized" ResizeMode="NoResize" in xaml of your window:

<Window x:Class="Miscellaneous.EditForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Edit Form" WindowState="Maximized" ResizeMode="NoResize"></Window>

这篇关于如何?WPF 窗口 - 最大化,不调整大小/移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆