不好意思,忘了是VB了:
Private Sub HelpDemo_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.SizeChanged
If (Me.Width >= 80) Then
Me.ShowHelp.Width = (Me.Width - 24) / 2
Me.helpProvider.Width = (Me.Width - 24) / 2
End If
Me.ShowHelp.Height = Me.Height - 16
Me.helpProvider.Height = Me.Height - 16
Me.helpProvider.Location = New Point(Me.ShowHelp.Width + 16, Me.helpProvider.Location.Y)
Dim w As Integer = 0, h As Integer = 0
If (Me.ShowHelp.Width >= Me.Panel1.Width) Then
w = (Me.ShowHelp.Width - Me.Panel1.Width) / 2
End If
If (Me.ShowHelp.Height >= Me.Panel1.Height + 80) Then
h = 48
ElseIf (Me.ShowHelp.Height >= Me.Panel1.Height + 12) Then
h = (Me.ShowHelp.Height - Me.Panel1.Height) / 2
Else
h = 12
End If
Me.Panel1.Location = New Point(w, h)
If (Me.helpProvider.Width > 40) Then
Me.Label2.Width = Me.helpProvider.Width - 40
End If
If (Me.helpProvider.Width >= Me.GroupBox1.Width) Then
w = (Me.helpProvider.Width - Me.GroupBox1.Width) / 2
Else
w = 0
End If
Me.GroupBox1.Location = New Point(w, 64 + Me.Label2.Height)
Me.GroupBox2.Location = New Point(w, 160 + Me.Label2.Height)
Me.GroupBox3.Location = New Point(w, 280 + Me.Label2.Height)
End Sub