Esempio n. 1
0
        public override Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Line.Visible = MsoTriState.msoFalse;
            shape.ThreeD.Depth = SyncFormatConstants.DisplayImageDepth;

            // don't set type if type is TypeMixed, it throws an exception
            if (formatShape.ThreeD.BevelTopType != MsoBevelType.msoBevelTypeMixed)
            {
                shape.ThreeD.BevelTopType = formatShape.ThreeD.BevelTopType;
                // set depth & inset only if type is not none,
                // adjusting these 2 will automatically set type from None to Round
                if (shape.ThreeD.BevelTopType != MsoBevelType.msoBevelNone)
                {
                    shape.ThreeD.BevelTopDepth = SyncFormatConstants.DisplayBevelHeight;
                    shape.ThreeD.BevelTopInset = SyncFormatConstants.DisplayBevelWidth;
                }
            }
            shape.ThreeD.BevelBottomType = MsoBevelType.msoBevelNone;
            shape.ThreeD.SetPresetCamera(MsoPresetCamera.msoCameraPerspectiveAbove);
            shape.ThreeD.PresetLighting = MsoLightRigType.msoLightRigBalanced;
            Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape));

            shape.Delete();
            return(image);
        }
        public override Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Line.Visible            = MsoTriState.msoFalse;
            shape.ThreeD.Depth            = SyncFormatConstants.DisplayImageDepth;
            shape.ThreeD.BevelTopType     = SyncFormatConstants.DisplayBevelType;
            shape.ThreeD.BevelTopDepth    = SyncFormatConstants.DisplayBevelHeight;
            shape.ThreeD.BevelTopInset    = SyncFormatConstants.DisplayBevelWidth;
            shape.ThreeD.BevelBottomType  = SyncFormatConstants.DisplayBevelType;
            shape.ThreeD.BevelBottomDepth = SyncFormatConstants.DisplayBevelHeight;
            shape.ThreeD.BevelBottomInset = SyncFormatConstants.DisplayBevelWidth;
            // setting mixed throws an exception
            // show flat type instead, which looks very similar
            if (formatShape.ThreeD.PresetMaterial == MsoPresetMaterial.msoPresetMaterialMixed)
            {
                shape.ThreeD.PresetMaterial = MsoPresetMaterial.msoMaterialFlat;
            }
            else
            {
                shape.ThreeD.PresetMaterial = formatShape.ThreeD.PresetMaterial;
            }
            shape.ThreeD.SetPresetCamera(SyncFormatConstants.DisplayCameraPreset);
            Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape));

            shape.Delete();
            return(image);
        }
        public override Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Line.Visible            = MsoTriState.msoFalse;
            shape.ThreeD.Depth            = SyncFormatConstants.DisplayImageDepth;
            shape.ThreeD.BevelTopType     = SyncFormatConstants.DisplayBevelType;
            shape.ThreeD.BevelTopDepth    = SyncFormatConstants.DisplayBevelHeight;
            shape.ThreeD.BevelTopInset    = SyncFormatConstants.DisplayBevelWidth;
            shape.ThreeD.BevelBottomType  = SyncFormatConstants.DisplayBevelType;
            shape.ThreeD.BevelBottomDepth = SyncFormatConstants.DisplayBevelHeight;
            shape.ThreeD.BevelBottomInset = SyncFormatConstants.DisplayBevelWidth;

            // setting mixed throws an exception
            if (formatShape.ThreeD.PresetLighting != MsoLightRigType.msoLightRigMixed)
            {
                shape.ThreeD.PresetLighting = formatShape.ThreeD.PresetLighting;
            }
            shape.ThreeD.SetPresetCamera(SyncFormatConstants.DisplayCameraPreset);

            Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape));

            shape.Delete();
            return(image);
        }
        public override Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Fill.ForeColor.RGB          = formatShape.ThreeD.ContourColor.RGB;
            shape.Fill.ForeColor.TintAndShade = formatShape.ThreeD.ContourColor.TintAndShade;

            shape.Line.Visible = MsoTriState.msoFalse;
            Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape));

            shape.Delete();
            return(image);
        }
        public override Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            // do not sync extrusion theme color with forecolor, it throws an exception
            shape.Fill.ForeColor.RGB          = formatShape.ThreeD.ExtrusionColor.RGB;
            shape.Fill.ForeColor.TintAndShade = formatShape.ThreeD.ExtrusionColor.TintAndShade;
            shape.Line.Visible = MsoTriState.msoFalse;
            Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape));

            shape.SafeDelete();
            return(image);
        }
Esempio n. 6
0
        public static Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;

            int guessedColor = ShapeUtil.GuessTextColor(formatShape);

            shape.Fill.ForeColor.RGB = guessedColor;
            shape.Fill.BackColor.RGB = guessedColor;
            shape.Fill.Solid();
            Bitmap image = GraphicsUtil.ShapeToBitmap(shape);

            shape.Delete();
            return(image);
        }
Esempio n. 7
0
        public override Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;

            shape.Fill.ForeColor.RGB          = formatShape.Glow.Color.RGB;
            shape.Fill.ForeColor.Brightness   = formatShape.Glow.Color.Brightness;
            shape.Fill.ForeColor.TintAndShade = formatShape.Glow.Color.TintAndShade;
            shape.Fill.Solid();

            Bitmap image = GraphicsUtil.ShapeToBitmap(shape);

            shape.Delete();
            return(image);
        }