ThreeDFormat
Contenido
[
Ocultar
]Clase ThreeDFormat
Representa propiedades 3-D.
public sealed class ThreeDFormat : PVIObject, IThreeDFormat
Propiedades
Nombre | Descripción |
---|---|
AsIPresentationComponent { get; } | Permite obtener la interfaz base IPresentationComponent. Solo lectura IPresentationComponent . |
BevelBottom { get; } | Devuelve o establece el tipo de un bisel 3D inferior. Solo lectura IShapeBevel . |
BevelTop { get; } | Devuelve o establece el tipo de un bisel 3D superior. Solo lectura IShapeBevel . |
Camera { get; } | Devuelve o establece la configuración de una cámara. Solo lectura ICamera . |
ContourColor { get; } | Devuelve o establece el color de un contorno. Solo lectura IColorFormat . |
ContourWidth { get; set; } | Devuelve o establece el ancho de un contorno 3D. Lectura/escritura Double. |
Depth { get; set; } | Devuelve o establece la profundidad de una forma 3D. Lectura/escritura Double. |
ExtrusionColor { get; } | Devuelve o establece el color de una extrusión. Solo lectura IColorFormat . |
ExtrusionHeight { get; set; } | Devuelve o establece la altura de un efecto de extrusión. Lectura/escritura Double. |
LightRig { get; } | Devuelve o establece el tipo de una luz. Solo lectura ILightRig . |
Material { get; set; } | Devuelve o establece el tipo de un material. Lectura/escritura MaterialPresetType . |
Métodos
Nombre | Descripción |
---|---|
override Equals(object) | Compara con el objeto especificado. |
GetEffective() | Obtiene los datos de formato 3-D efectivos con la herencia aplicada. |
override GetHashCode() | Devuelve el código hash. |
Ejemplos
El siguiente ejemplo muestra cómo agregar una forma 3D en una presentación de PowerPoint.
[C#]
// Crear una instancia de la clase Presentation.
using (Presentation pres = new Presentation())
{
// Agregar una forma usando el método AddAutoShape
IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 200, 150, 200, 200);
// Definir TextFrame y sus propiedades
shape.TextFrame.Text = "3D";
shape.TextFrame.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 64;
// Definir propiedades de ThreeDFormat
shape.ThreeDFormat.Camera.CameraType = CameraPresetType.OrthographicFront;
shape.ThreeDFormat.Camera.SetRotation(20, 30, 40);
shape.ThreeDFormat.LightRig.LightType = LightRigPresetType.Flat;
shape.ThreeDFormat.LightRig.Direction = LightingDirection.Top;
shape.ThreeDFormat.Material = MaterialPresetType.Flat;
shape.ThreeDFormat.ExtrusionHeight = 100;
shape.ThreeDFormat.ExtrusionColor.Color = Color.Blue;
pres.Slides[0].GetThumbnail(2, 2).Save("sample_3d.png");
// Guardar el archivo de presentación
pres.Save("sandbox_3d.pptx", SaveFormat.Pptx);
}
El siguiente ejemplo muestra cómo aplicar un efecto de degradado a una forma 3D en una presentación de PowerPoint.
[C#]
// Crear una instancia de la clase Presentation.
using (Presentation pres = new Presentation())
{
// Agregar una forma usando el método AddAutoShape
IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 200, 150, 250, 250);
// Definir TextFrame y sus propiedades
shape.TextFrame.Text = "3D Gradient";
shape.TextFrame.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 64;
// Configurar FillFormat.FillType como FillType.Gradient y definir propiedades de degradado
shape.FillFormat.FillType = FillType.Gradient;
shape.FillFormat.GradientFormat.GradientStops.Add(0, Color.Blue);
shape.FillFormat.GradientFormat.GradientStops.Add(100, Color.Orange);
// Definir propiedades de ThreeDFormat
shape.ThreeDFormat.Camera.CameraType = CameraPresetType.OrthographicFront;
shape.ThreeDFormat.Camera.SetRotation(20, 30, 40);
shape.ThreeDFormat.LightRig.LightType = LightRigPresetType.Flat;
shape.ThreeDFormat.LightRig.Direction = LightingDirection.Top;
shape.ThreeDFormat.Material = MaterialPresetType.Flat;
shape.ThreeDFormat.ExtrusionHeight = 100;
shape.ThreeDFormat.ExtrusionColor.Color = Color.Blue;
pres.Slides[0].GetThumbnail(2, 2).Save("sample_3d.png");
// Guardar el archivo de presentación
pres.Save("sandbox_3d.pptx", SaveFormat.Pptx);
}
El siguiente ejemplo muestra cómo aplicar un efecto 3D al texto. Para crear un texto 3D es posible usar el efecto de transformación de WordArt.
[C#]
// Crear una instancia de la clase Presentation.
using (Presentation pres = new Presentation())
{
// Agregar una forma usando el método AddAutoShape
IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 200, 150, 250, 250);
// Definir TextFrame y sus propiedades
shape.TextFrame.Text = "3D Text";
// Configurar FillFormat.FillType como FillType.NoFill
shape.FillFormat.FillType = FillType.NoFill;
shape.LineFormat.FillFormat.FillType = FillType.NoFill;
// Configurar porción de TextFrame y configurar propiedades de PortionFormat
Portion portion = (Portion)shape.TextFrame.Paragraphs[0].Portions[0];
portion.PortionFormat.FillFormat.FillType = FillType.Pattern;
portion.PortionFormat.FillFormat.PatternFormat.ForeColor.Color = Color.DarkOrange;
portion.PortionFormat.FillFormat.PatternFormat.BackColor.Color = Color.White;
portion.PortionFormat.FillFormat.PatternFormat.PatternStyle = PatternStyle.LargeGrid;
shape.TextFrame.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 128;
ITextFrame textFrame = shape.TextFrame;
// configurar el efecto de transformación de WordArt "Arch Up"
textFrame.TextFrameFormat.Transform = TextShapeType.ArchUp;
// Definir propiedades de ThreeDFormat de ITextFrame
textFrame.TextFrameFormat.ThreeDFormat.ExtrusionHeight = 3.5f;
textFrame.TextFrameFormat.ThreeDFormat.Depth = 3;
textFrame.TextFrameFormat.ThreeDFormat.Material = MaterialPresetType.Plastic;
textFrame.TextFrameFormat.ThreeDFormat.LightRig.Direction = LightingDirection.Top;
textFrame.TextFrameFormat.ThreeDFormat.LightRig.LightType = LightRigPresetType.Balanced;
textFrame.TextFrameFormat.ThreeDFormat.LightRig.SetRotation(0, 0, 40);
textFrame.TextFrameFormat.ThreeDFormat.Camera.CameraType = CameraPresetType.PerspectiveContrastingRightFacing;
pres.Slides[0].GetThumbnail(2, 2).Save("text3d.png");
// Guardar el archivo de presentación
pres.Save("text3d.pptx", SaveFormat.Pptx);
}
Véase también
- clase PVIObject
- interfaz IThreeDFormat
- namespace Aspose.Slides
- assembly Aspose.Slides