我正在创建二十一点,我使用图片框。我点了一个名为picbox的新PictureBox,每当它们点击时,它就会创建一个带有卡片的新图片盒。当我们点击按钮获取新手时,我试图将其删除,它会删除我创建的所有图片框并清除我原来在那里的四个图片框。我无法弄清楚..我尝试使用Controls.Remove(picbox),但它只删除了其中一个。这是命中按钮的代码:
Private Sub HitButton_Click(sender As Object, e As EventArgs) Handles HitButton.Click
HitCard = DeckoCards.PlayingCard.GetCards(deck, 1).Item(0)
With picbox
.Height = 201
.Width = 125
End With
If PlayerTurn = 1 Then
Controls.Add(picbox)
DeckoCards.RealDeck.RealCards(HitCard, picbox)
picbox.Top = PlayerOneCard2PictureBox.Top
picbox.Left = xPosPlay1
xPosPlay1 += 40
picbox.BringToFront()
picbox = New PictureBox
ElseIf PlayerTurn = 2 Then
Controls.Add(picbox)
DeckoCards.RealDeck.RealCards(HitCard, picbox)
picbox.Top = PlayerOneCard2PictureBox.Top
picbox.Left = xPosPlay2
xPosPlay2 += 40
picbox.BringToFront()
End If
End Sub