2011-12-07 65 views
0

我需要調整自己的狀態,並使其佔據了屏幕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) 

但它沒有中心,任何人都可以幫幫我?

回答

0

解決方案

Dim Sw As Integer = CInt(Screen.PrimaryScreen.WorkingArea.Width * 0.8) 
Dim Sh As Integer = CInt(Screen.PrimaryScreen.WorkingArea.Height * 0.8) 
Me.Size = New Size(Sw, Sh) 
Dim x As Integer = Screen.PrimaryScreen.WorkingArea.Width \ 2 - Me.Width \ 2 
Dim y As Integer = Screen.PrimaryScreen.WorkingArea.Height \ 2 - Me.Height \ 2 
Me.Location = New Point(x, y) 
相關問題