private Bitmap[] ShapeTypesToBitmaps(Array types, string shapeType)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();

            Bitmap[] bitmaps = new Bitmap[types.Length];
            for (int i = 0; i < types.Length; i++)
            {
                if (!((MsoAutoShapeType)types.GetValue(i)).ToString().Contains(shapeType))
                {
                    continue;
                }
                try
                {
                    Shape shape = shapes.AddShape(
                        (MsoAutoShapeType)types.GetValue(i), 0, 0,
                        TooltipsLabConstants.DisplayImageSize.Width,
                        TooltipsLabConstants.DisplayImageSize.Height);
                    ShapeUtil.FormatCalloutToDefaultStyle(shape);
                    bitmaps[i] = new Bitmap(GraphicsUtil.ShapeToBitmap(shape));
                    shape.SafeDelete();
                }
                catch
                {
                }
            }
            return(bitmaps);
        }
Example #2
0
#pragma warning disable 0618
        /// <summary>
        /// Insert default callout box shape to slide.
        /// Precondition: shape with shapeName must not exist in slide before applying the method
        /// </summary>
        /// <param name="slide"></param>
        /// <param name="shapeName">shapeName is a string with format "PPTL_{tagNo}_Callout" to be associated
        /// with generated callout shape.</param>
        /// <param name="calloutText">Content in Callout Shape</param>
        /// <returns>generated callout shape</returns>
        public static Shape InsertDefaultCalloutBoxToSlide(PowerPointSlide slide, string shapeName, string calloutText)
        {
            float slideWidth  = PowerPointPresentation.Current.SlideWidth;
            float slideHeight = PowerPointPresentation.Current.SlideHeight;

            Shape calloutBox = slide.Shapes.AddShape(MsoAutoShapeType.msoShapeRoundedRectangularCallout, 10, 10, 100, 10);

            calloutBox.Name = shapeName;
            calloutBox.TextFrame.TextRange.Text = calloutText;
            calloutBox.Left = 10;
            calloutBox.Top  = 10;
            calloutBox.TextFrame.AutoSize   = PpAutoSize.ppAutoSizeShapeToFitText;
            calloutBox.TextEffect.Alignment = MsoTextEffectAlignment.msoTextEffectAlignmentLeft;
            ShapeUtil.FormatCalloutToDefaultStyle(calloutBox);

            return(calloutBox);
        }
Example #3
0
        public static PowerPoint.Shape GenerateCalloutWithReferenceTriggerShape(PowerPointSlide currentSlide, PowerPoint.Shape triggerShape)
        {
            float midpointX = ShapeUtil.GetMidpointX(triggerShape);


            PowerPoint.Shape callout = currentSlide.Shapes.AddShape(
                TooltipsLabSettings.ShapeType,
                midpointX - TooltipsLabConstants.CalloutShapeDefaultWidth / 2 + (float)(TooltipsLabConstants.CalloutArrowheadHorizontalAdjustment * TooltipsLabConstants.CalloutShapeDefaultWidth),
                triggerShape.Top - (float)(TooltipsLabConstants.CalloutArrowheadVerticalAdjustment * TooltipsLabConstants.CalloutShapeDefaultHeight) - TooltipsLabConstants.TriggerShapeAndCalloutSpacing,
                TooltipsLabConstants.CalloutShapeDefaultWidth,
                TooltipsLabConstants.CalloutShapeDefaultHeight);
            ShapeUtil.FormatCalloutToDefaultStyle(callout);

            callout.TextFrame2.AutoSize  = MsoAutoSize.msoAutoSizeTextToFitShape;
            callout.TextEffect.Alignment = MsoTextEffectAlignment.msoTextEffectAlignmentCentered;

            return(callout);
        }