Shapes3DEffect.cs
//
// This code is part of Document Solutions for Word demos.
// Copyright (c) MESCIUS inc. All rights reserved.
//
using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using GrapeCity.Documents.Word;

namespace DsWordWeb.Demos
{
    // This example shows how to add a 3D effect to a shape.
    public class Shapes3DEffect
    {
        public GcWordDocument CreateDocx()
        {
            var doc = new GcWordDocument();

            Paragraph paragraph = doc.Body.Paragraphs.Add();
            Run run = paragraph.GetRange().Runs.Add();
            Shape shape = run.GetRange().Shapes.Add(200, 200, GeometryType.Rectangle);
            shape.Fill.Type = FillType.Solid;
            shape.Fill.SolidFill.ThemeColor = ThemeColorId.Accent1;

            // apply 3D format
            ThreeDFormat threeD = shape.Effects.ThreeDFormat;
            threeD.TopBevel.ApplyPreset(BevelType.Convex);
            threeD.Contour.Color.ThemeColor = ThemeColorId.Accent2;
            threeD.Contour.Width = 3f;
            threeD.Contour.Color.ThemeColor = ThemeColorId.Accent6;
            threeD.Contour.Width = 12f;

            // apply 3D scene
            ThreeDScene scene = shape.Effects.ThreeDScene;
            scene.Camera.Preset = CameraPreset.PerspectiveContrastingRightFacing;
            scene.Lighting.Type = LightRigType.BrightRoom;
            scene.Lighting.Rotation.Latitude = 90f;
            scene.Lighting.Rotation.Revolution = 5f;

            // Done:
            return doc;
        }
    }
}