在wpf窗口中禁用最大容量 [英] disable maximize capacity in a wpf window

查看:74
本文介绍了在wpf窗口中禁用最大容量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在wpf窗口中禁用最大化容量(而不是最大化按钮),但是到目前为止没有任何成功.

I'm trying to disable the maximize capacity (not the maximize button) in a wpf window, but so far nothing has succeded.

我正在使用WindowStyle ="none"的窗口,但是当我将窗口拖动到屏幕的最上方时,操作系统会最大化"该窗口(顺便说一句,很糟糕).

I'm using a window with WindowStyle="none", but when I drag the window to the far top of the screen, the OS "maximizes" the window (terribly bad, by the way).

我上传了3张照片,以显示发生了什么事情.

I uploaded 3 pictures to show what is happening exactly.

(但是,由于我没有10个声誉,因此我不得不发布链接.抱歉.我不能放置所有3个链接,只有2个,但是第一个只是窗口正常工作)

(however, due to the fact that I don't have 10 reputation, I have to post the links instead. Sorry about that. And I can't put all 3 links, only 2 of them, but the first one is just of the window working normally)

在:

之后:

推荐答案

使用窗口状态更改事件:

use the window state change event:

private void Window_StateChanged(object sender, EventArgs e)
{
    if (this.WindowState == System.Windows.WindowState.Maximized) 
    {
        this.WindowState = System.Windows.WindowState.Normal; 
    }
}

这篇关于在wpf窗口中禁用最大容量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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