예제 #1
0
 private void buttonSameHeightOrWidth_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         PowerPoint.Selection selection     = Globals.ThisAddIn.Application.ActiveWindow.Selection;
         HeightOrWidth        heightOrWidth = e.Control.Id == btnSameHeight.Id ? HeightOrWidth.Height : HeightOrWidth.Width;
         ToolsSizeAndPosition.SameHeightOrWidth(selection, heightOrWidth);
     }
     catch (Exception ex)
     {
         Exceptions.Handle(ex);
     }
 }
예제 #2
0
 public static void SameHeightOrWidth(PowerPoint.Selection selection, HeightOrWidth heightOrWidth)
 {
     foreach (PowerPoint.Shape shape in selection.ShapeRange)
     {
         if (heightOrWidth == HeightOrWidth.Height)
         {
             shape.Height = selection.ShapeRange[1].Height;
         }
         else
         {
             shape.Width = selection.ShapeRange[1].Width;
         }
     }
 }