如何在 C#.Net 中最小化和最大化? [英] How to minimize and maximize in C#.Net?

查看:33
本文介绍了如何在 C#.Net 中最小化和最大化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一个问题.我想在 C#.net 中手动最小化和最大化.我将表单的 BorderStyle 更改为 none.所以栏上没有最大化、最小化和关闭按钮.我想用这些功能的按钮手动创建.我想在三个按钮的点击事件中完成这三个功能.我怎样才能做到这一点?如果可以,请告诉我.感谢您抽出宝贵时间.

I would like to ask a question. I want to minimize and maximize manually in C#.net. I changed form's BorderStyle into none. So there are no maximize,minimize and close button from bar. I want to manually create with button like those function. I want to do that three function in three button's click events. How can i do that? Please let me know if you can. Thanks your for your time.

推荐答案

你必须像这样设置窗体的 WindowState 属性:

You have to set the forms WindowState property something like this:

在 Windows 窗体中:

In Windows Forms:

private void button1_Click(object sender, EventArgs e)
{
    this.WindowState = FormWindowState.Minimized;
}

在 WPF 中:

private void button1_Click(object sender, RoutedEventArgs e)
{
    this.WindowState = WindowState.Minimized;
}

这篇关于如何在 C#.Net 中最小化和最大化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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