GDI绘图的一个疑问
在程序里,一般来说都是应该从开始执行到下面的吧???
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分,全给了
[解决办法]
是先执行上面的部分的,只不过效果没有及时显示出来而已
中间加Application.DoEvents试一下
[解决办法]
可以把弹出对话框改为一个延时一定时间