扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
先用image对象在后台加载。完了后赋给picturebox.image. 音乐文件类似用filestream
主要从事网页设计、PC网站建设(电脑版网站建设)、wap网站建设(手机版网站建设)、自适应网站建设、程序开发、微网站、成都小程序开发等,凭借多年来在互联网的打拼,我们在互联网网站建设行业积累了丰富的网站建设、成都网站设计、网络营销经验,集策划、开发、设计、营销、管理等多方位专业化运作于一体,具备承接不同规模与类型的建设项目的能力。
Dim i As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
i = i + 1
If i 3 Then Timer1.Enabled = False : Exit Sub
PictureBox1.ImageLocation = "z:\" i ".png"
End Sub
1,不要将这些代码放在Form.Load事件里,最好放在构造函数中!
2,加上:
me.SuspendLayout()'如果按钮在其它容器中(如GroupBox):me.grp.SuspendLayout();
'...Loading Images
me.ResumeLayout();
图形绘制最快的是Panel控件,用Panel速度蛮快
'先建立一个bitmap对象,指向图像文件
Dim pic As Bitmap = New Bitmap("e:\1.jpg")
'定义一个图片框的graphics对象
Dim g As Graphics = PictureBox1.CreateGraphics()
'在图片框上绘图
g.DrawImage(pic, 0, 0, pic.Width, pic.Height)
'释放bitmap对象
pic.Dispose()
'现在即可对文件进行操作
***怎样让移动图像显示更快一些*** Hide Controls When Setting Properties to Avoid Multiple Repaints Every repaint is expensive. The fewer repaints Visual Basic must perform, the faster your application will appear. One way to reduce the number of repaints is to make controls invisible while you are manipulating them. For example, suppose you want to resize several list boxes in the Resize event for the form: Sub Form_Resize () Dim i As Integer, sHeight As Integer sHeight = ScaleHeight / 4 For i = 0 To 3 lstDisplay(i).Move 0, i * sHeight, _ ScaleWidth, sHeight Next End Sub This creates four separate repaints, one for each list box. You can reduce the number of repaints by placing all the list boxes within a picture box, and hiding the picture box before you move and size the list boxes. Then, when you make the picture box visible again, all of the list boxes are painted in a single pass: 在vb中用move方法移动图片时,速度有些慢,当图片很大时,这时可以用下面的方法: Sub Form_Resize () Dim i As Integer, sHeight As Integer picContainer.Visible = False picContainer.Move 0, 0, ScaleWidth, ScaleHeight sHeight = ScaleHeight / 4 For i = 0 To 3 lstDisplay(i).Move 0, i * sHeight, _ ScaleWidth, sHeight Next picContainer.Visible = True End Sub Note that this example uses the Move method instead of setting the Top and Left properties. The Move method sets both properties in a single operation, saving additional repaints.
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流