public void AlignHorizontalToSlide() { var shapes = GetCurrentlySelectedShapes(); if (shapes.Count <= 0) { Error(TextCollection.DrawingsLabSelectAtLeastOneShape); return; } var dialog = new AlignmentDialogVertical(); if (dialog.ShowDialog() != true) { return; } if (dialog.DialogResult != true) { return; } Globals.ThisAddIn.Application.StartNewUndoEntry(); double sourceAnchor = dialog.SourceAnchor / 100; double targetAnchor = dialog.TargetAnchor / 100; double targetX = targetAnchor * PowerPointPresentation.Current.SlideWidth; foreach (var shape in shapes) { shape.Left = (float)(targetX - sourceAnchor * shape.Width); } }
public void AlignVertical() { var shapes = GetCurrentlySelectedShapes(); if (shapes.Count <= 1) { Error(TextCollection.DrawingsLabSelectAtLeastTwoShapes); return; } var dialog = new AlignmentDialogVertical(); if (dialog.ShowDialog() != true) { return; } if (dialog.DialogResult != true) { return; } Globals.ThisAddIn.Application.StartNewUndoEntry(); double sourceAnchor = dialog.SourceAnchor / 100; double targetAnchor = dialog.TargetAnchor / 100; var targetShape = shapes.Last(); shapes.RemoveAt(shapes.Count - 1); double targetX = targetShape.Left + targetAnchor * targetShape.Width; foreach (var shape in shapes) { shape.Left = (float)(targetX - sourceAnchor * shape.Width); } }
public void AlignVertical() { var shapes = GetCurrentlySelectedShapes(); if (shapes.Count <= 1) { Error(TextCollection.DrawingsLabSelectAtLeastTwoShapes); return; } var dialog = new AlignmentDialogVertical(); if (dialog.ShowDialog() != true) return; if (dialog.DialogResult != true) return; Globals.ThisAddIn.Application.StartNewUndoEntry(); double sourceAnchor = dialog.SourceAnchor / 100; double targetAnchor = dialog.TargetAnchor / 100; var targetShape = shapes.Last(); shapes.RemoveAt(shapes.Count - 1); double targetX = targetShape.Left + targetAnchor * targetShape.Width; foreach (var shape in shapes) { shape.Left = (float)(targetX - sourceAnchor * shape.Width); } }
public void AlignHorizontalToSlide() { var shapes = GetCurrentlySelectedShapes(); if (shapes.Count <= 0) { Error(TextCollection.DrawingsLabSelectAtLeastOneShape); return; } var dialog = new AlignmentDialogVertical(); if (dialog.ShowDialog() != true) return; if (dialog.DialogResult != true) return; Globals.ThisAddIn.Application.StartNewUndoEntry(); double sourceAnchor = dialog.SourceAnchor / 100; double targetAnchor = dialog.TargetAnchor / 100; double targetX = targetAnchor * PowerPointPresentation.Current.SlideWidth; foreach (var shape in shapes) { shape.Left = (float)(targetX - sourceAnchor * shape.Width); } }