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

主宰稳场 提交于 2019-12-11 02:50:03

问题


I have a windows which hasResizeMode="CanResizeWithGrip" and AllowTransparency="true" set. 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.


回答1:


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;
    }


来源:https://stackoverflow.com/questions/19475258/how-to-disable-maximizing-of-a-window-when-the-window-is-moved-to-the-top-left-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!