GDI绘图的一个疑问

半支烟z 2007-07-28 02:09:11
在程序里,一般来说都是应该从开始执行到下面的吧???

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Dim img2 As Image
img2 = New Bitmap("images/2007-07-11-02.bmp")
PictureBox2.Controls.Add(PictureBox1)
PictureBox2.Width = 200
PictureBox2.Height = 200
PictureBox2.Location = New Point(0, 0)
PictureBox2.BackgroundImage = img2
PictureBox1.Width = 150
PictureBox1.Height = 150
PictureBox1.Location = New Point(10, 10)
Dim b2 As Image = New Bitmap(150, 150)
Dim g2 As Graphics = Graphics.FromImage(b2)
g2.DrawImage(img2, 0, 0, 100, 100)
PictureBox1.BackgroundImage = b2
Dim pic3 As PictureBox = New PictureBox
PictureBox1.Controls.Add(pic3)
pic3.Width = 100
pic3.Height = 100
pic3.Location = New Point(10, 10)
pic3.BackColor = Color.Transparent
Dim b3 As Image = New Bitmap(100, 100)
Dim g3 As Graphics = Graphics.FromImage(b3)
g3.DrawImage(img2, 0, 0, 50, 50)
Dim i As Integer
For i = 0 To 50
pic3.BackgroundImage = b3
Next
'MsgBox("fccc")
'===============================================================
Dim g As Graphics = pic3.CreateGraphics
Dim myb As New Bitmap("images/flash.bmp")
Dim sourceRectangle As New Rectangle(0, 0, 100, 100)
Dim destRectangle1 As New Rectangle(0, 0, 100, 100)
Dim destRectangle2 As New Rectangle(210, 40, 80, 45)
For i = 0 To 50
sourceRectangle = New Rectangle(0, i * 100, 100, 100)
g.DrawImage(myb, destRectangle1, sourceRectangle, GraphicsUnit.Pixel)
Next
'
pic3.Dispose()
End Sub

这里竟然先实行=====下面的部分之后在显示上面的部分!

但是如果加上一个弹出的对话匡的话就没有问题了

还请各位前辈和高人指点一二!!!

严重谢谢,就20分,全给了
...全文
169 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
leq_82 2007-07-29
  • 打赏
  • 举报
回复
可以把弹出对话框改为一个延时一定时间
半支烟z 2007-07-28
  • 打赏
  • 举报
回复
是显示的问题,那除了 viena() 维也纳(windows7) 前辈指点的外还有什么方法?
xiaoku 2007-07-28
  • 打赏
  • 举报
回复
应该是显示的问题而已。
半支烟z 2007-07-28
  • 打赏
  • 举报
回复
恩,可是加上这个会很消耗的吧?
忘了在哪查到的说这个尽量少用,用不好会崩溃的吗????
那除了这个没有别的了吗?
viena 2007-07-28
  • 打赏
  • 举报
回复
是先执行上面的部分的,只不过效果没有及时显示出来而已
中间加Application.DoEvents试一下

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧