2014-01-18 1 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 
관련 문제