以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求程序打开后界面居右代码?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=83871)

--  作者:jiterp
--  发布时间:2016/4/18 22:45:00
--  求程序打开后界面居右代码?
以下代码是论坛中找到的,就是找开后,界面设成固定大小,并保持在屏幕左上角,如果我要让窗口居中,怎么改下面的代码?

With baseMainForm

    .show
    .WindowState = Windows.Forms.FormWindowState.Normal
    .Width = 215
    .Height = 600
    .top = 0
    .left = 0
End With

谢谢!

--  作者:大红袍
--  发布时间:2016/4/18 23:28:00
--  

Dim w As Integer = SysInfo.WorkingAreaWidth
Dim h As Integer = SysInfo.WorkingAreaHeight

With baseMainForm
    .show
    .WindowState = Windows.Forms.FormWindowState.Normal
    .Width = 215
    .Height = 600
    .top = (h-.height) / 2
    .left = (w-.width) / 2
End With