要怎么判断鼠标按下并移动
我用两个image做类似按钮的按键,分别叫bai,hong,当点击bai时bai消失hong显示,当点击hong时bai显示hong消失,代码如下程序代码:
Private Sub bai_Click(Index As Integer) bai(Index).Visible = False hong(Index).Visible = True End Sub Private Sub hong_Click(Index As Integer) bai(Index).Visible = True hong(Index).Visible = False End Subbai和hong都是控件组,都是75个,排列方式和系统的“TrueType 造字程序”差不多,我还想要把它做成像“TrueType 造字程序”的效果一样,当按下鼠标左键然后移动时,就像铅笔一样,连续性地让bai或hong显示出来,我在mouse_move的事件里面这样写却不行,当按住鼠标左键移动时只有第一个被点到的有出现效果,其他移动过的地方都没效果
程序代码:
Private Sub bai_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then bai(Index).Visible = False hong(Index).Visible = True End If End Sub Private Sub hong_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then bai(Index).Visible = True hong(Index).Visible = False End If End Sub