网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
07月19日漏签0天
vb.net吧 关注:7,023贴子:37,210
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 0回复贴,共1页
<<返回vb.net吧
>0< 加载中...

实在想不明白为什么每次都只绘制一个矩形

  • 只看楼主
  • 收藏

  • 回复
  • 枫飞铃兰
  • shaogod
    7
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
Public Class Form1
Public Structure Bullet
Public Shared x As Integer
Public Shared y As Integer
End Structure
Dim b As Bitmap
Dim g As Graphics
Dim BL As List(Of Bullet)
Dim AddTime As Integer
Dim MoveTime As Integer
Dim DrawTime As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
b = New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height)
g = Graphics.FromImage(b)
BL = New List(Of Bullet)
AddTime = 0
MoveTime = 0
DrawTime = 0
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
AddTime += 1
MoveTime += 1
DrawTime += 1
If AddTime > 100 Then
Dim bul As Bullet = New Bullet
bul.x = 100
bul.y = Me.ClientSize.Height - 10
BL.Add(bul)
AddTime = 0
End If
If MoveTime > 5 And BL.Count > 0 Then
For i = 0 To BL.Count - 1
If BL.Item(i).y < 5 Then
BL.RemoveAt(i)
Else
BL.Item(i).y -= 1
End If
Next
MoveTime = 0
End If
If DrawTime > 10 And BL.Count > 0 Then
g.Clear(Me.BackColor)
For i = 0 To BL.Count - 1
g.FillRectangle(Brushes.Blue, BL.Item(i).x, BL.Item(i).y, 5, 5)
Next
Me.CreateGraphics.DrawImage(b, 0, 0)
DrawTime = 0
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "错误")
End Try
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
End Class


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 0回复贴,共1页
<<返回vb.net吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示