16,550
社区成员
发帖
与我相关
我的任务
分享
'根据数组画图
Private Sub drawELS(ByVal x As Integer, ByVal y As Integer, ByVal s As Integer, ByVal z As Integer, ByVal a As Integer)
Dim picGraphics As System.Drawing.Graphics
Dim gr As New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim sizeFK1 As Integer = 30
picGraphics = Graphics.FromImage(gr)
Dim i As Integer, j As Integer
Dim x1, y1 As Integer
For i = 0 To 18
For j = 1 To 12
If myFK.elsFKsuzu2(i, j) + myFK.elsFKsuzu(i, j) = 1 Then
x1 = (j - 1) * 30
y1 = i * 30
picGraphics.FillRectangle(myBrush, New Rectangle(x1, y1, sizeFK1, sizeFK1))
picGraphics.DrawLine(myFK.myFKforeC, x1, y1, x1 + sizeFK1, y1)
picGraphics.DrawLine(myFK.myFKforeC, x1 + sizeFK1, y1, x1 + sizeFK1, y1 + sizeFK1)
picGraphics.DrawLine(myFK.myFKforeC, x1, y1, x1, y1 + sizeFK1)
picGraphics.DrawLine(myFK.myFKforeC, x1, y1 + sizeFK1, x1 + sizeFK1, y1 + sizeFK1)
End If
Next
Next
Dim gg As Graphics
gg = PictureBox1.CreateGraphics
gg.Clear(Color.Black)
gg.SmoothingMode = Drawing2D.SmoothingMode.Default
gg.DrawImage(gr, 0, 0)
myBrush.Dispose()
picGraphics.Dispose()
End Sub
'根据数组画图
Private Sub drawELS(ByVal x As Integer, ByVal y As Integer, ByVal s As Integer, ByVal z As Integer, ByVal a As Integer)
Dim picGraphics As System.Drawing.Graphics
Dim gr As New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim sizeFK1 As Integer = 30
picGraphics = Graphics.FromImage(gr)
Dim i As Integer, j As Integer
Dim x1, y1 As Integer
For i = 0 To 18
For j = 1 To 12
If myFK.elsFKsuzu2(i, j) + myFK.elsFKsuzu(i, j) = 1 Then
x1 = (j - 1) * 30
y1 = i * 30
picGraphics.FillRectangle(myBrush, New Rectangle(x1, y1, sizeFK1, sizeFK1))
picGraphics.DrawLine(myFK.myFKforeC, x1, y1, x1 + sizeFK1, y1)
picGraphics.DrawLine(myFK.myFKforeC, x1 + sizeFK1, y1, x1 + sizeFK1, y1 + sizeFK1)
picGraphics.DrawLine(myFK.myFKforeC, x1, y1, x1, y1 + sizeFK1)
picGraphics.DrawLine(myFK.myFKforeC, x1, y1 + sizeFK1, x1 + sizeFK1, y1 + sizeFK1)
End If
Next
Next
picturebox1.image=gr
myBrush.Dispose()
picGraphics.Dispose()
End Sub