Shape3DRotationEffect.vb
C# VB
'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports System.DrawingImports GrapeCity.Documents.Word
'' This example shows how to add a 3D rotation effect to a shape.Public Class Shape3DRotationEffect Function CreateDocx() As GcWordDocument Dim doc = New GcWordDocument()
Dim paragraph As Paragraph = doc.Body.Paragraphs.Add() Dim run As Run = paragraph.GetRange().Runs.Add() Dim shape As Shape = run.GetRange().Shapes.Add(200, 200, GeometryType.Rectangle) shape.Fill.Type = FillType.Solid shape.Fill.SolidFill.ThemeColor = ThemeColorId.Accent1
shape.Line.Fill.Type = FillType.NoFill
Dim shadow As OuterShadow = shape.Effects.Shadow shadow.Alignment = RectangleAlignment.Center shadow.Angle = 87F shadow.Blur = 17.75F shadow.Distance = 4F shadow.Color.RGB = Color.FromArgb(255, 0, 0, 0) shadow.Color.Transparency = 0.67F
'' apply 3D format Dim threeDFormat As ThreeDFormat = shape.Effects.ThreeDFormat threeDFormat.Depth.Width = 20F threeDFormat.Contour.Width = 1.5F threeDFormat.Contour.Color.RGB = Color.FromArgb(255, 255, 255, 255)
Dim topbevel As Bevel = threeDFormat.TopBevel topbevel.Type = BevelType.Angle topbevel.Width = 6.5F topbevel.Height = 3.5F
Dim bottomBevel As Bevel = threeDFormat.BottomBevel bottomBevel.Type = BevelType.Angle bottomBevel.Width = 6.5F bottomBevel.Height = 3.5F
'' apply 3D scene Dim lighting As Lighting = shape.Effects.ThreeDScene.Lighting lighting.Type = LightRigType.Harsh lighting.Direction = LightRigDirection.Top lighting.Rotation.Latitude = 0F lighting.Rotation.Longitude = 0F lighting.Rotation.Revolution = 50F
Dim camera As Camera = shape.Effects.ThreeDScene.Camera camera.Preset = CameraPreset.PerspectiveFront camera.Perspective = 55F camera.Rotation.Latitude = 8.1F camera.Rotation.Longitude = 325.5F camera.Rotation.Revolution = 2.9F
'' Done: Return doc End FunctionEnd Class