0

フォームのサイズを変更して、画面の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)

しかし、それは中心ではありません、誰かが助けることができますか?

4

2 に答える 2

1

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

すばらしい答えのある同様の質問: VisualBasicで画面の右下隅にフォームを配置します

于 2011-12-07T12:04:48.383 に答える
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)
于 2011-12-07T12:15:44.317 に答える