picturebox问题

123工艺品 123工艺品 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在picturebox里画图,每0.5秒画一次,怎么图片老是闪烁呢?

'根据数组画图
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

备注:数组是变化的
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
123工艺品
VB 16,718 成员 110,520 内容