我正在为一个类项目在 Visual Basic 中创建一个刽子手游戏,并且我创建了一个函数,当您在单词中的适当位置猜出正确的字母时,它会绘制一个字符串。我的问题是,每当我做出新的猜测时,它都会删除旧图形并添加新图形。我需要一种方法来保存我绘制的图形,有人知道吗?
Dim newCharArray() As Char = wordArray(rndNumber).ToCharArray
For i As Integer = 0 To (wordArray(rndNumber).Length - 1) Step 1
If TextBox1.Text = newCharArray(i) Then
correctLetter = newCharArray(i)
letterPos = i
Me.Refresh()
End If
Next
Dim drawFont As New Font("Microsoft YaHei UI", 16)
Dim drawBrush As New SolidBrush(Color.Black)
Dim drawString As [String] = CStr(correctLetter)
Dim drawPoint As New PointF(x:=(x1 + 4) + (letterPos * 40), y:=363)
e.Graphics.DrawString(drawString, drawFont, drawBrush, drawPoint)