如何在C#屏幕上居中的窗口? [英] How do I center a window onscreen in c#?

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

问题描述

我需要一种方法来居中当前窗口。因此,例如,如果用户按下一个按钮时,我希望窗口屏幕中心本身。我知道你可以使用属性指定startPosition,但我不能想出一个办法使用比其他当应用程序首先启动。那么,如何做我中心的形式在屏幕上?

I need a way to center the current window. So for example, if a user pushes a button, I want the window to center itself onscreen. I know you can use the startposition property, but I cannot figure out a way to use that other than when the application first starts up. So how do I center the form on the screen?

推荐答案

使用的 Form.CenterToScreen()方法

这篇关于如何在C#屏幕上居中的窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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