0
的左上部分這裏是我的代碼的DrawString只適用於形式vb.net
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
正如你所看到的,我有一個按鈕,繪製字符串「文本」隨機形式的10倍。我的問題是,它只會在窗體的左上角繪製字符串,大約260x260從0,0開始。如果超出範圍,它會切斷文本。爲什麼是這樣?它應該不適用於整個表單嗎?
謝謝soooo多了,這讓我感到困擾不已。 – WillumMaguire
@WillumMaguire沒問題 – K3N