Exemple #1
0
        public void AlignVerticalToSlide()
        {
            var shapes = GetCurrentlySelectedShapes();

            if (shapes.Count <= 0)
            {
                Error(TextCollection.DrawingsLabSelectAtLeastOneShape);
                return;
            }

            var dialog = new AlignmentDialogHorizontal();

            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 targetY = (1 - targetAnchor) * PowerPointPresentation.Current.SlideHeight;

            foreach (var shape in shapes)
            {
                shape.Top = (float)(targetY - (1 - sourceAnchor) * shape.Height);
            }
        }
Exemple #2
0
        public void AlignHorizontal()
        {
            var shapes = GetCurrentlySelectedShapes();

            if (shapes.Count <= 1)
            {
                Error(TextCollection.DrawingsLabSelectAtLeastTwoShapes);
                return;
            }

            var dialog = new AlignmentDialogHorizontal();

            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 targetY = targetShape.Top + (1 - targetAnchor) * targetShape.Height;

            foreach (var shape in shapes)
            {
                shape.Top = (float)(targetY - (1 - sourceAnchor) * shape.Height);
            }
        }
        public void AlignHorizontal()
        {
            var shapes = GetCurrentlySelectedShapes();
            if (shapes.Count <= 1)
            {
                Error(TextCollection.DrawingsLabSelectAtLeastTwoShapes);
                return;
            }

            var dialog = new AlignmentDialogHorizontal();
            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 targetY = targetShape.Top + (1 - targetAnchor) * targetShape.Height;
            foreach (var shape in shapes)
            {
                shape.Top = (float)(targetY - (1 - sourceAnchor) * shape.Height);
            }
        }
        public void AlignVerticalToSlide()
        {
            var shapes = GetCurrentlySelectedShapes();
            if (shapes.Count <= 0)
            {
                Error(TextCollection.DrawingsLabSelectAtLeastOneShape);
                return;
            }

            var dialog = new AlignmentDialogHorizontal();
            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 targetY = (1 - targetAnchor) * PowerPointPresentation.Current.SlideHeight;
            foreach (var shape in shapes)
            {
                shape.Top = (float)(targetY - (1 - sourceAnchor) * shape.Height);
            }
        }