调整大小并将表单居中至屏幕的 80%
我需要调整我的表单大小并使其占据屏幕的 80%,目前,这就是我所拥有的,
Dim Sw As Integer = CInt(Screen.PrimaryScreen.Bounds.Width * 0.8)
Dim Sh As Integer = CInt(Screen.PrimaryScreen.Bounds.Height * 0.8)
Dim nTaskBarHeight As Integer = Screen.PrimaryScreen.Bounds.Bottom - Screen.PrimaryScreen.WorkingArea.Bottom
Me.Size = New Size(Sw, Sh - nTaskBarHeight)
但它不居中,任何人都可以帮忙吗?
I need to resize my form and make it occupy 80% of the screen, currently, this is what i have
Dim Sw As Integer = CInt(Screen.PrimaryScreen.Bounds.Width * 0.8)
Dim Sh As Integer = CInt(Screen.PrimaryScreen.Bounds.Height * 0.8)
Dim nTaskBarHeight As Integer = Screen.PrimaryScreen.Bounds.Bottom - Screen.PrimaryScreen.WorkingArea.Bottom
Me.Size = New Size(Sw, Sh - nTaskBarHeight)
But it does not center, can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您仅更改尺寸;
也改变我的位置;仍然需要做一些数学计算:)
类似的问题有很好的答案:
职位表单在 Visual Basic 中屏幕右下角
You are changing only Size;
change Me.Location too; still need do some math for it :)
similar question with great answer:
Position form at the bottom right corner of the screen in visual basic
解决方案
The solution