protected void SyncShapes(PowerPoint.ShapeRange selected, PowerPoint.ShapeRange simulatedShapes) { for (int i = 1; i <= selected.Count; i++) { var selectedShape = selected[i]; var simulatedShape = simulatedShapes[i]; selectedShape.IncrementLeft(ShapeUtil.GetCenterPoint(simulatedShape).X - ShapeUtil.GetCenterPoint(selectedShape).X); selectedShape.IncrementTop(ShapeUtil.GetCenterPoint(simulatedShape).Y - ShapeUtil.GetCenterPoint(selectedShape).Y); selectedShape.Rotation = simulatedShape.Rotation; } }
protected void SyncShapes(PowerPoint.ShapeRange selected, PowerPoint.ShapeRange simulatedShapes, float[,] originalPositions) { for (int i = 1; i <= selected.Count; i++) { var selectedShape = selected[i]; var simulatedShape = simulatedShapes[i]; selectedShape.IncrementLeft(ShapeUtil.GetCenterPoint(simulatedShape).X - originalPositions[i - 1, Left]); selectedShape.IncrementTop(ShapeUtil.GetCenterPoint(simulatedShape).Y - originalPositions[i - 1, Top]); SwapZOrder(selectedShape, simulatedShape); } }
// Generate a trigger shape directly in the center bottom position of the specified callout shape. public static PowerPoint.Shape GenerateTriggerShapeWithReferenceCallout(PowerPointSlide currentSlide, PowerPoint.Shape callout) { float left = ShapeUtil.GetCenterPoint(callout).X - TooltipsLabConstants.TriggerShapeDefaultWidth / 2; float top = ShapeUtil.GetBottom(callout) + TooltipsLabConstants.TriggerShapeAndCalloutSpacing; PowerPoint.Shape triggerShape = currentSlide.Shapes.AddShape( TooltipsLabConstants.TriggerShape, left, top, TooltipsLabConstants.TriggerShapeDefaultWidth, TooltipsLabConstants.TriggerShapeDefaultHeight); ShapeUtil.FormatTriggerShapeToDefaultStyle(triggerShape); return(triggerShape); }