ThreeDFormat

ThreeDFormat classe

Représente les propriétés 3-D.

public sealed class ThreeDFormat : PVIObject, IThreeDFormat

Propriétés

NomDescription
AsIPresentationComponent { get; }Permet d’obtenir l’interface de base IPresentationComponent. Lecture seule IPresentationComponent.
BevelBottom { get; }Renvoie ou définit le type d’un biseau 3D inférieur. Lecture seule IShapeBevel.
BevelTop { get; }Renvoie ou définit le type d’un biseau 3D supérieur. Lecture seule IShapeBevel.
Camera { get; }Renvoie ou définit les paramètres d’une caméra. Lecture seule ICamera.
ContourColor { get; }Renvoie ou définit la couleur d’un contour. Lecture seule IColorFormat.
ContourWidth { get; set; }Renvoie ou définit la largeur d’un contour 3D. Lecture/écriture Double.
Depth { get; set; }Renvoie ou définit la profondeur d’une forme 3D. Lecture/écriture Double.
ExtrusionColor { get; }Renvoie ou définit la couleur d’une extrusion. Lecture seule IColorFormat.
ExtrusionHeight { get; set; }Renvoie ou définit la hauteur d’un effet d’extrusion. Lecture/écriture Double.
LightRig { get; }Renvoie ou définit le type d’une lumière. Lecture seule ILightRig.
Material { get; set; }Renvoie ou définit le type d’un matériau. Lecture/écriture MaterialPresetType.

Méthodes

NomDescription
override Equals(object)Compare avec l’objet spécifié.
GetEffective()Obtient les données de formatage 3-D effectif avec l’héritage appliqué.
override GetHashCode()Renvoie le code de hachage.

Exemples

L’exemple suivant montre comment ajouter une forme 3D dans une présentation PowerPoint.

[C#]
// Créer une instance de la classe Presentation.
using (Presentation pres = new Presentation())
{
	// Ajouter une forme en utilisant la méthode AddAutoShape.
    IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 200, 150, 200, 200);
	// Définir le TextFrame et ses propriétés
    shape.TextFrame.Text = "3D";
    shape.TextFrame.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 64;
	// Définir les propriétés 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");
	// Enregistrer le fichier Presentation.
    pres.Save("sandbox_3d.pptx", SaveFormat.Pptx);
}

L’exemple suivant montre comment appliquer un effet de dégradé à une forme 3D dans une présentation PowerPoint.

[C#]
// Créer une instance de la classe Presentation.
using (Presentation pres = new Presentation())
{
	// Ajouter une forme en utilisant la méthode AddAutoShape
     IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 200, 150, 250, 250);
	// Définir le TextFrame et ses propriétés
    shape.TextFrame.Text = "3D Gradient";
    shape.TextFrame.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 64;
	// Configurer FillFormat.FillType comme FillType.Gradient et définir les propriétés du dégradé
	shape.FillFormat.FillType = FillType.Gradient;
    shape.FillFormat.GradientFormat.GradientStops.Add(0, Color.Blue);
    shape.FillFormat.GradientFormat.GradientStops.Add(100, Color.Orange);
	// Définir les propriétés 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");
	// Enregistrer le fichier Presentation.
    pres.Save("sandbox_3d.pptx", SaveFormat.Pptx);
}

L’exemple suivant montre comment appliquer un effet 3D sur du texte. Pour créer du texte 3D, il est possible d’utiliser l’effet de transformation WordArt.

[C#]
// Créer une instance de la classe Presentation.
using (Presentation pres = new Presentation())
{
	// Ajouter une forme en utilisant la méthode AddAutoShape
     IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 200, 150, 250, 250);
	// Définir le TextFrame et ses propriétés
    shape.TextFrame.Text = "3D Text";
	// Configurer FillFormat.FillType comme FillType.NoFill
	shape.FillFormat.FillType = FillType.NoFill;
    shape.LineFormat.FillFormat.FillType = FillType.NoFill;
	// Configurer la Portion du TextFrame et les propriétés 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;
    // configurer l'effet de transformation WordArt "Arch Up"
    textFrame.TextFrameFormat.Transform = TextShapeType.ArchUp;
	// Définir les propriétés 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");
	// Enregistrer le fichier Presentation.
     pres.Save("text3d.pptx", SaveFormat.Pptx);
}

Voir aussi