怎样让移动图像显示更快一些...

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 coolstar 的 blog

                           ***怎样让移动图像显示更快一些***

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.

本文关键:vb move Image fast
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top