2014-01-18 78 views
-1

是否有可能在子中有一個子?是否有可能在一個子內有一個子?

Public Class Form1 

    Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click 
     Sub anim() Handles form2.Shown 

      Me.Refresh() 

      Do Until Me.Location.X = 350 
       form2.Location = New Point(Me.Location.X + 1, 250) 
       ' System.Threading.Thread.Sleep(0.5) 
      Loop 
       form2.close() 
     End Sub 
    End Sub 
End Class 

回答

1

你可以這樣說:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
    Dim form2 As New Form2() 

    Dim anim = Sub() 
        form2.Refresh() 
        Do Until form2.Location.X = 350 
         form2.Location = New Point(form2.Location.X + 1, 250) 
         ' System.Threading.Thread.Sleep(0.5) 
        Loop 

       End Sub 

    AddHandler form2.Shown, anim 
    form2.Show() 
End Sub 
相關問題