获取一个 CommandBars 集合,该集合表示 Microsoft Office Word 中的菜单栏和所有工具栏。
程序集: Microsoft.Office.Tools.Word.v4.0.Utilities(Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
public CommandBars CommandBars { get; }
在访问 CommandBars 集合之前,使用 P:Microsoft.Office.Interop.Word._Application.CustomizationContext 属性设置模板或文档上下文。
下面的代码示例使“绘图”工具栏在应用程序的底部可见。若要使用此示例,请从文档级项目内的ThisDocument类中运行此示例。
private void DocumentCommandBars() { this.CommandBars["Drawing"].Visible = true; this.CommandBars["Drawing"].Position = Office.MsoBarPosition.msoBarBottom; }