我试过用控制image的移动,这种停顿应该没法消除。
如果你要比较好的效果的话,还是用api函数的bitblt来贴图吧,
当然能用directx自然更好

解决方案 »

  1.   


     将Form1的AutoRedraw设为TRUE。
      

  2.   

    将Form1的AutoRedraw设为TRUE就会更慢.移动控件快不到那里去的,换别的方面实现吧.
      

  3.   

    有停顿感不是因为你程序的问题,你在输入文本的时候不是也会按紧字母键,它就先打出一个,然后停一会再快速连续打出吗?解决办法是用API -- GetAsyncKeyState
    在while循环里面加入它就可以了 ,例如检测向下按钮:
    GetAsyncKeyState(VK_DOWN)
      

  4.   

    试着要消除停顿感是不大现实的,到目前为止我还没有看到有哪本书介绍可以消除停顿感的。如果你解决了这个问题的话也请告诉我一下
    [email protected]
      

  5.   

    因为楼上说没法消除停顿感,我特此作了一个试验,窗体上放置一个picturebox,置form的keypreview为true
    大家试试看,到底有没有停顿感(这种方法可以不使用GetAsyncKeyState,我采取了一种变通的办法)Dim movingleft As Boolean
    Dim movingright As Boolean
    Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case 37:
        movingleft = True
        movingright = False
    Case 39:
        movingleft = False
        movingright = True
    End Select
    End SubPrivate Sub Picture1_KeyUp(KeyCode As Integer, Shift As Integer)
        movingleft = False
        movingright = False
    End SubPrivate Sub Timer1_Timer()
    If movingleft = True Then
     Picture1.Left = Picture1.Left - 15
    End If
    If movingright = True Then
      Picture1.Left = Picture1.Left + 15
    End If
    End Sub
      

  6.   

    下面函数改进一下Private Sub Picture1_KeyUp(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case 37:
        movingleft = False
    Case 39:
        movingright = False
    End Select
    End Sub