这是我的代码
Public Class Form1
Public MyFormObject As Graphics = Me.CreateGraphics
Public objFont = New System.Drawing.Font("arial", 20)
Public a, b As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Randomize()
For i = 1 To 10
a = CInt(Int(Rnd() * Me.Width))
b = CInt(Int(Rnd() * Me.Height))
MyFormObject.DrawString("text", objFont, System.Drawing.Brushes.Black, a, b)
Next
End Sub
End Class
如您所见,我有一个按钮可以在表单中随机绘制字符串“text” 10 次。我的问题是它只会在表单的左上角绘制字符串,大约 260x260 从 0,0 开始。如果超出,它会从字面上切断文本。为什么是这样?它不应该适用于整个表格吗?