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


C# Shape.get_RowCount方法代码示例

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


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

示例1: AddRightMouseAction

        /// <summary>This method adds a right mouse action to a shape. The 
        /// right mouse action is added to the Actions section of the given
        /// shape.</summary>
        /// <param name="targetShape">Shape to add the action item to.</param>
        /// <param name="menuCaption">Caption for the newly created menu item.
        /// </param>
        /// <param name="menuAction">Action to be taken when the menu item is
        /// selected. This is a formula in universal syntax.</param>
        /// <param name="menuEnabled">Initial enabled state of the menu item.
        /// </param>
        /// <param name="menuChecked">Initial checked state of the menu item.
        /// </param>
        /// <param name="beginGroup">display a divider bar above the command 
        /// in the menu.</param>
        /// <param name="addToBottom">display the command at the bottom of the
        ///  menu.</param>
        private static void AddRightMouseAction(Shape targetShape, string menuCaption, string menuAction,
            bool menuEnabled, bool menuChecked, bool beginGroup, bool addToBottom)
        {
            const string DividerBarPrefix = "_";
            const string AddToBottomPrefix = "%";
            const string AcceleratorPrefix = "&";

            if (menuCaption == null || targetShape == null)
                return;

            short actionRow;
            short actionRows;
            string taggedMenuCaption;
            string rowCaption;
            string cleanMenuCaption;
            Cell actionCell;

            try {
                // the menuCaption string may need to be modified to include a
                // tag that indicates the menu should be at the bottom, or
                // should be preceeded by a separator line.
                taggedMenuCaption = menuCaption;
                if (taggedMenuCaption == null)
                    throw new ArgumentNullException("Menu caption is null");

                // strip modifier tokens from the caption
                cleanMenuCaption = menuCaption.Replace(AcceleratorPrefix, "");

                // Check if the right menu action item already exists.
                actionRows = targetShape.get_RowCount((short)VisSectionIndices.visSectionAction);

                bool actionExists = false;

                for (actionRow = 0; (actionExists == false) && (actionRow < actionRows); actionRow++) {
                    actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
                        (short)(VisRowIndices.visRowAction + actionRow),
                        (short)VisCellIndices.visActionMenu);

                    rowCaption = Common.FormulaStringToString(actionCell.FormulaU);

                    // strip modifier tokens from the caption before compare
                    rowCaption = rowCaption.Replace(DividerBarPrefix, "");
                    rowCaption = rowCaption.Replace(AddToBottomPrefix, "");
                    rowCaption = rowCaption.Replace(AcceleratorPrefix, "");

                    if (rowCaption == cleanMenuCaption)
                        actionExists = true;
                }

                if (actionExists == false) {
                    // prefix underscore (_) to the caption to add a separator
                    // line above it.
                    if (beginGroup == true && taggedMenuCaption != null)
                        taggedMenuCaption = taggedMenuCaption.Insert(0, DividerBarPrefix);

                    // prefix percent (%) to the caption to add it to the
                    // bottom of the menu.
                    if (addToBottom == true)
                        taggedMenuCaption = taggedMenuCaption.Insert(0, AddToBottomPrefix);

                    // Add a new action row to the shape.
                    actionRow = targetShape.AddRow((short)VisSectionIndices.visSectionAction,
                        (short)VisRowIndices.visRowLast,
                        (short)VisRowIndices.visRowAction);

                    // Set the menu caption.
                    actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
                        actionRow,
                        (short)VisCellIndices.visActionMenu);
                    actionCell.FormulaU = Common.StringToFormulaForString(taggedMenuCaption);

                    // Set the action for the menu item.
                    actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
                        actionRow,
                        (short)VisCellIndices.visActionAction);
                    actionCell.FormulaU = menuAction;

                    // Set the menu item's enabled/disabled state.
                    actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
                        actionRow,
                        (short)VisCellIndices.visActionDisabled);
                    actionCell.set_ResultFromInt(VisUnitCodes.visNumber,
                        Convert.ToInt32(!menuEnabled, System.Globalization.CultureInfo.InvariantCulture));

//.........这里部分代码省略.........
开发者ID:jeffkosa,项目名称:PathMakerOS_Root,代码行数:101,代码来源:Repair.Support.cs

示例2: RemoveRightMouseAction

        // Removes the action associated with using the right mouse on a shape
        private static void RemoveRightMouseAction(Shape targetShape, string menuCaption)
        {
            const string DividerBarPrefix = "_";
            const string AddToBottomPrefix = "%";
            const string AcceleratorPrefix = "&";

            if (menuCaption == null || targetShape == null)
                return;

            short actionRow;
            short actionRows;
            string taggedMenuCaption;
            string rowCaption;
            string cleanMenuCaption;
            Cell actionCell;

            try {
                // the menuCaption string may need to be modified to include a
                // tag that indicates the menu should be at the bottom, or
                // should be preceeded by a separator line.
                taggedMenuCaption = menuCaption;
                if (taggedMenuCaption == null)
                    throw new ArgumentNullException("Menu caption is null");

                // strip modifier tokens from the caption
                cleanMenuCaption = menuCaption.Replace(AcceleratorPrefix, "");

                // Check if the right menu action item already exists.
                actionRows = targetShape.get_RowCount((short)VisSectionIndices.visSectionAction);

                bool actionExists = false;

                for (actionRow = 0; (actionExists == false) && (actionRow < actionRows); actionRow++) {
                    actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
                        (short)(VisRowIndices.visRowAction + actionRow),
                        (short)VisCellIndices.visActionMenu);

                    rowCaption = Common.FormulaStringToString(actionCell.FormulaU);

                    // strip modifier tokens from the caption before compare
                    rowCaption = rowCaption.Replace(DividerBarPrefix, "");
                    rowCaption = rowCaption.Replace(AddToBottomPrefix, "");
                    rowCaption = rowCaption.Replace(AcceleratorPrefix, "");

                    if (rowCaption == cleanMenuCaption) {
                        targetShape.DeleteRow((short)VisSectionIndices.visSectionAction, (short)(VisRowIndices.visRowAction + actionRow));
                        actionExists = true;
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException err) {
                System.Diagnostics.Debug.WriteLine(err.Message);
            }
        }
开发者ID:jeffkosa,项目名称:PathMakerOS_Root,代码行数:55,代码来源:Repair.Support.cs


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