How to make moving images faster ...

zhaozj2021-02-08  230

*** How to make moving images faster some ***

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 Of

The List Boxes Are Painted In A Single Pass:

When moving pictures in VB, the speed is slow, and when the picture is large, you can use the following method:

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

..

转载请注明原文地址:https://www.9cbs.com/read-3241.html

New Post(0)