2012-08-02 86 views
0

有没有办法在指定位置的CommandBar上放置菜单项/ commandbarbutton?例如在位置0(顶部)。CommandBar在指定位置的菜单项

我使用直接代码添加(),我很失望地看到AddAT()不在那里。我的菜单出现并正常工作。我想将它添加到指定的位置。

button = (CommandBarButton) 
    cellbar.Controls.Add(MsoControlType.msoControlButton, 
    Missing.Value, Missing.Value, 
    cellbar.Controls.Count, true); 

感谢

回答

2

的第四个参数是 “之前”。因此,将您的代码更改为:

button = (CommandBarButton) 
    cellbar.Controls.Add(MsoControlType.msoControlButton, 
    Missing.Value, Missing.Value, 
    1, true);