当前位置: 首页>>代码示例>>C#>>正文


C# Microsoft.Office.Core.Add方法代码示例

本文整理汇总了C#中Microsoft.Office.Core.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Core.Add方法的具体用法?C# Microsoft.Office.Core.Add怎么用?C# Microsoft.Office.Core.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Office.Core的用法示例。


在下文中一共展示了Microsoft.Office.Core.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddCommandBar

        /// <summary>
        /// Add a new command bar to PPT.
        /// </summary>
        /// <param name="bars">the bars object to which to add the new bar</param>
        /// <param name="name">the name of the bar.</param>
        /// <param name="position">the position of the bar.</param>
        /// <param name="visible">should the bar be visible immediately</param>
        /// <param name="replace">should existing bars of the same name be deleted (an error is thrown if replace is false and a bar of the same name exists)</param>
        /// <returns>the newly created bar</returns>
        public Core.CommandBar AddCommandBar(Core.CommandBars bars, string name, 	
			Core.MsoBarPosition position, bool visible, bool replace)
        {
            Debug.Assert(bars != null, "bars must be non-null");
            Debug.Assert(name != null && name != "", "name must be non-null and non-empty");
            Debug.Assert(Enum.IsDefined(position.GetType(), position), "position has an invalid value");

            Core.CommandBar newBar = null;

            // Delete all bars with the same name.
            foreach (Core.CommandBar bar in bars)
                if (bar.Name == name)
                {
                    if (replace)
                    {
                        newBar = bar;
                        break;
                    }
                    else
                        throw new Exception("A bar by the name \"" + name + "\" already exists.");
                }
            if (newBar == null)
                newBar = bars.Add(name, position, false, false);
            if (newBar.Visible != visible)
                newBar.Visible = visible;
            this.myObjectCache.Add(newBar);
            return newBar;
        }
开发者ID:kevinbrink,项目名称:CP3_Enhancement,代码行数:37,代码来源:PPT.cs


注:本文中的Microsoft.Office.Core.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。