大家有没有发现过IE的工具栏当按钮很多的时候,或者IE窗口太小的时候,工具栏最右边会有一个箭头,点击就能出现没显示出来的按钮菜单请问这是怎么实现的,给TOOLBAR加一个样式吗顶贴的都有分,谢谢

解决方案 »

  1.   

    我搜索到这篇文章:
    MSDN: Creating an Internet Explorer-style Toolbar
    Version 5.80 of the common controls provides a way to make tools that have been covered by another band accessible to the user. If you set the RBBS_USECHEVRON flag in the fStyle member of the band's REBARBANDINFO structure, a chevron will be displayed for toolbars that have been covered. When a user clicks the chevron, a menu is displayed that allows him or her to use the hidden tools. The following illustration from Internet Explorer 6 shows the menu that is displayed when part of the standard toolbar is covered.
    ……
    Initialize a band for the control by filling in the members of REBARBANDINFO. Include the RBBS_USECHEVRON style with the fStyle member to enable chevrons.
    ……
    Handling Chevrons
    When a user clicks a chevron, the rebar control sends your application an RBN_CHEVRONPUSHED notification. The NMREBARCHEVRON structure that is passed with the notification contains the band's identifier and a RECT structure with the rectangle occupied by the chevron. Your handler must determine which buttons are hidden and display the associated commands on a pop-up menu.The following procedure outlines how to handle an RBN_CHEVRONPUSHED notification:Retrieve the current bounding rectangle for the selected band by sending the rebar control an RB_GETRECT message. 
    Retrieve the total number of buttons by sending the band's toolbar control a TB_BUTTONCOUNT message. 
    Starting from the leftmost button, retrieve the button's bounding rectangle by sending the toolbar control a TB_GETITEMRECT message. 
    Pass the band and button rectangles to IntersectRect. This function will return a RECT structure that corresponds to the visible portion of the button. 
    Pass the button rectangle and the rectangle for the visible portion of the button to EqualRect. 
    If EqualRect returns TRUE, the entire button is visible. Repeat steps 3-5 for the next button on the toolbar. If EqualRect returns FALSE, the button is at least partially hidden and all remaining buttons will be completely hidden. Continue to the next step. 
    Create a pop-up menu with items for each of the hidden buttons. 
    Display the pop-up menu with TrackPopupMenu. Use the chevron rectangle passed with the RBN_CHEVRONPUSHED notification to position the menu. The menu should be immediately below the chevron, with the left edges aligned. 
    ……
    Chevrons
    When the user rearranges the bands in the rebar control, part of a toolbar might be covered up. If the band was created with the RBBS_USECHEVRON style, the rebar control will display a chevron at the right edge of the toolbar. The user clicks the chevron to display a menu with the hidden tools. For a discussion on how to implement chevrons, see Handling Chevrons.
      

  2.   

    问题是我给TOOLBAR加了RBBS_USECHEVRON属性后好像不行啊反而少了一个按钮显示,晕啊晕啊
      

  3.   

    或许考虑在加button的时候,给它加个属性