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


C# Shape.Ungroup方法代码示例

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


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

示例1: ReorganiseBeam

        /// <summary>
        /// Reorganises the positions of all the text boxes in the beam.
        /// </summary>
        private static void ReorganiseBeam(PowerPointSlide refSlide, List<AgendaSection> newSections, Shape highlightedTextBox,
            Shape background, BeamFormats beamFormats, List<Shape> oldTextBoxes, Shape beamShape)
        {
            var newTextBoxes = CreateBeamAgendaTextBoxes(refSlide, newSections);
            SetupBeamTextBoxPositions(newTextBoxes, highlightedTextBox, background);

            for (int i = 0; i < newTextBoxes.Count; ++i)
            {
                var referenceTextFormat = beamFormats.Regular;
                if (i < oldTextBoxes.Count) referenceTextFormat = oldTextBoxes[i].TextFrame2.TextRange;

                Graphics.SyncTextRange(referenceTextFormat, newTextBoxes[i].TextFrame2.TextRange, pickupTextContent: false);
            }

            oldTextBoxes.ForEach(shape => shape.Delete());

            var beamShapeShapes = beamShape.Ungroup().Cast<Shape>().ToList();
            beamShapeShapes.AddRange(newTextBoxes);
            beamShape = refSlide.GroupShapes(beamShapeShapes);
            AgendaShape.SetShapeName(beamShape, ShapePurpose.BeamShapeMainGroup, AgendaSection.None);
        }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:24,代码来源:AgendaLabMain.cs

示例2: UpdateBeamItems

        /// <summary>
        /// Does not reogranise the positions of the text boxes in the beam. Instead, it only deletes text boxes
        /// that no longer correspond to a section, and creates new text boxes for the new sections.
        /// </summary>
        private static void UpdateBeamItems(PowerPointSlide refSlide, List<AgendaSection> newSections, Shape highlightedTextBox,
                Shape background, BeamFormats beamFormats, List<Shape> oldTextBoxes, Shape beamShape)
        {
            List<Shape> markedForDeletion;
            var textboxAssignment = GetBeamTextboxAssignment(oldTextBoxes, out markedForDeletion);

            var reassignedTextboxIndexes = new HashSet<int>();
            var newTextboxes = new List<Shape>();

            foreach (var section in newSections)
            {
                int index = section.Index;
                if (textboxAssignment.ContainsKey(index))
                {
                    // Reuse old textbox
                    var textbox = textboxAssignment[index];
                    Graphics.SetText(textbox, section.Name);
                    AgendaShape.SetShapeName(textbox, ShapePurpose.BeamShapeText, section);
                    reassignedTextboxIndexes.Add(index);
                }
                else
                {
                    // Create new textbox
                    var textbox = PrepareBeamAgendaBeamItem(refSlide, section);
                    var referenceTextFormat = beamFormats.Regular;
                    Graphics.SyncTextRange(referenceTextFormat, textbox.TextFrame2.TextRange, pickupTextContent: false);
                    newTextboxes.Add(textbox);
                }
            }
            
            markedForDeletion.AddRange(from entry in textboxAssignment where !reassignedTextboxIndexes.Contains(entry.Key) select entry.Value);
            markedForDeletion.ForEach(shape => shape.Delete());

            var beamShapeShapes = beamShape.Ungroup().Cast<Shape>().ToList();
            beamShapeShapes.AddRange(newTextboxes);
            beamShape = refSlide.GroupShapes(beamShapeShapes);
            AgendaShape.SetShapeName(beamShape, ShapePurpose.BeamShapeMainGroup, AgendaSection.None);
        }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:42,代码来源:AgendaLabMain.cs


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