如果窗体状态最大化,如何对齐中心面板 [英] How to align center panel if windows state of form is maximized

查看:51
本文介绍了如果窗体状态最大化,如何对齐中心面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以windows形式开展项目我希望在整个屏幕上打开表格这就是为什么我希望面板在中心



我有什么试过:



i试图调整中心但没有任何事情发生

解决方案

你可以随时在表格SizeChanged事件中处理它。

我没有为你完成所有数学运算但这样的事情应该有效:



private void Form1_SizeChanged(object sender,EventArgs e)

{

this.panel1.Left = this.Width / 2;

}

i am working on project in windows form i want to open form on whole screen thats why i want panel to be on center

What I have tried:

i have tried to align center but nothing happen

解决方案

You could always handle it in the forms SizeChanged event.
I didn't work all the math out for you but something like this should work:

private void Form1_SizeChanged(object sender, EventArgs e)
{
this.panel1.Left = this.Width / 2;
}


这篇关于如果窗体状态最大化,如何对齐中心面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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