如何触发以最大化在C#中相关联的事件 [英] How to trigger the event associated with maximize in C#
本文介绍了如何触发以最大化在C#中相关联的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑下面的代码:
Window myWindow = new MyWindowSubclass();
myWindow.BringIntoView();
myWindow.Show();
// Code which is effective as pressing the maximize button
此外,如何检测如果窗口确实是在最大化状态。
Also, how to detect if the window is indeed in maximized state.
推荐答案
在WPF中,可以使用的的WindowState 属性:
In WPF, you can use the WindowState property:
myWindow.WindowState = WindowState.Maximized;
您当然可以查询该属性来获取当前窗口的状态:
You can of course query that property to obtain the current window state:
if (myWindow.WindowState == WindowState.Maximized) {
// Window is currently maximized.
}
这篇关于如何触发以最大化在C#中相关联的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文