简体   繁体   English

当窗口移到屏幕的左上角时,如何禁用最大化窗口?

[英]How to disable maximizing of a window when the window is moved to the top left corner of the screen?

I have a windows which hasResizeMode="CanResizeWithGrip" and AllowTransparency="true" set. 我有一个设置了ResizeMode =“ CanResizeWithGrip”和AllowTransparency =“ true”的窗口。 It works fine until it is moved to the top of the screen when it is then automatically Maximized. 它可以正常工作,直到将其移到屏幕顶部,然后自动将其最大化。

How can stop it maximizing so I can display the screen as a window positioned at the top of the screen. 如何停止最大化播放,以便将屏幕显示为位于屏幕顶部的窗口。

Try: 尝试:

private void Window_LocationChanged(object sender, EventArgs e)
{
    this.WindowState = System.windows.WindowState.Normal;
}

If you have to be specific, check for your location: 如果需要具体说明,请检查您的位置:

    if (this.Top == 0)
    {
        this.WindowState = System.windows.WindowState.Normal;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在.NET 4中最大化窗口时,窗口顶部和左侧值未正确更新 - Window Top and Left values are not updated correctly when maximizing a Window in .NET 4 C#WPF-显示“子”窗口时,父窗口跳到屏幕的左上角 - C# WPF - Parent window jumps to top left corner of screen when Child window is shown 如何禁用窗口自动最大化? - How to Disable Window from Automatically Maximizing? WPF窗口左上角不透明 - WPF Window top left corner not being transparent 当用户将窗口拖动到屏幕的顶部/右侧/左侧时,如何避免尺寸变化 - How to avoid size change when user drag window to top/right/left of screen 基于Window的左上角错误地获取了画布的位图 - Taking bitmap of Canvas is incorrectly based on top left corner of Window 如何在屏幕角落创建小window - How to create small window in the corner of the screen C#WinForms-用于检测鼠标指针移动到窗体或窗口左下角的事件 - C# WinForms - Event to detect mouse pointer moved to lower left corner of form or window 当 DropDownStyle 为 Simple 时,ToolStripCombobox 显示在屏幕的左上角 - ToolStripCombobox displays at the top left corner of the screen when DropDownStyle is Simple DispatcherTimer在最小化/最大化/关闭窗口时暂停 - DispatcherTimer pauses when minimizing/maximizing/closing window
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM