两个菜单按钮,我想实现1按下2弹起,2按下1弹起的互斥效果,为什么下边的不行?
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Index
        Case 1:
        Toolbar1.Buttons(1).Value = tbrPressed
        Toolbar1.Buttons(2).Value = tbrUnpressed        Case 2:        Toolbar1.Buttons(1).Value = tbrUnpressed
        Toolbar1.Buttons(2).Value = tbrPressed
  End Select
End Sub

解决方案 »

  1.   


        Toolbar1.Buttons(1).Value = tbrUnpressed
        Toolbar1.Buttons(2).Value = tbrUnpressed
        Toolbar1.Buttons(3).Value = tbrUnpressed
        
        Toolbar1.Buttons(Button.Index).Value = tbrPressed    Toolbar1.Refresh
        
    前面可以通过循环来实现
      

  2.   

    掉了个    Toolbar1.Refresh
    多谢!
      

  3.   


     Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
        Select Case Button.Index
            Case 1:
            Toolbar1.Buttons(1).Value = tbrPressed
            Toolbar1.Buttons(2).Value = tbrUnpressed
            Toolbar1.Refresh
            Case 2:        Toolbar1.Buttons(1).Value = tbrUnpressed
            Toolbar1.Buttons(2).Value = tbrPressed
            Toolbar1.Refresh'加上这个
      End Select
    End Sub
      

  4.   

    TOOLBAR本身就有这个功能吧 我记得不用写代码的