2011-12-07 10 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) 
1

サイズのみが変更されています。 Me.Locationも変更します。まだそれのためにいくつかの計算を行う必要があります:)

偉大な答えで同様の質問: Position form at the bottom right corner of the screen in visual basic

+0

おかげで、それは私が本当に – Smith

+0

を行うために必要なもののアイデアを与えました助けてうれしい:) – Anton

関連する問題