menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IMotionCmdPath - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Interface IMotionCmdPath

    Represents the motion command path.

    Namespace: Syncfusion.Presentation
    Assembly: Syncfusion.Presentation.Base.dll
    Syntax
    public interface IMotionCmdPath

    Properties

    CommandType

    Get the command type of motion effect

    Declaration
    MotionCommandPathType CommandType { get; set; }
    Property Value
    Type
    MotionCommandPathType
    Examples
    // Create a new presentation.
    IPresentation ppDoc = Presentation.Create();
    // Add a slide to the presentation.
    ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
    // Add shape on the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
    // Add animation effect on the slide with shape
    IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
    // Get the behaviors list from the effect
    IBehaviors behaviors = effect.Behaviors;
    // Get behavior using foreach loop
    //Add the line command to move the shape in straight line
    PointF[] points = new PointF[1];
    points[0] = new PointF(0, 0.25f);
    foreach (IBehavior behavior in behaviors)
    {
    if (behavior is IMotionEffect)
    {
    // Assign the motion effect values
    IMotionEffect motionEffect = (behavior as MotionEffect);
    IMotionPath path = (motionEffect.Path as IMotionPath);
    path[0].CommandType = MotionCommandPathType.MoveTo;
    break;
    }
    }
    // Save the presentation file
    ppDoc.Save("Sample.pptx");
    // Close the presentation file
    ppDoc.Close();
    'Create a new presentation
    Dim ppDoc As IPresentation = Presentation.Create()
    'Add a slide to the presentation.
    Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
    'Add shape on the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
    'Add animation effect on the slide with shape
    Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
    'Get the behaviors list from the effect
    Dim behaviors As IBehaviors = effect.Behaviors
    'Get behavior using foreach loop
    For Each behavior As IBehavior In behaviors
    'Check condition for behavior is motion effect
    If (TypeOf behavior Is IMotionEffect) Then
    'Assign the motion effect values
    Dim motionEffect As IMotionEffect = TryCast(behavior,IMotionEffect)
    Dim path As IMotionPath = TryCast(motionEffect.Path, IMotionPath)
    path(0).CommandType = MotionCommandPathType.MoveTo
    Exit For
    End If
    Next
    'Save the presentation file
    ppDoc.Save("Sample.pptx")
    'Close the presentation file
    ppDoc.Close()

    IsRelative

    Get the relative value

    Declaration
    bool IsRelative { get; set; }
    Property Value
    Type
    System.Boolean
    Examples
    // Create a new presentation.
    IPresentation ppDoc = Presentation.Create();
    // Add a slide to the presentation.
    ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
    // Add shape on the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
    // Add animation effect on the slide with shape
    IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
    // Get the behaviors list from the effect
    IBehaviors behaviors = effect.Behaviors;
    // Get behavior using foreach loop
    foreach (IBehavior behavior in behaviors)
    {
    if (behavior is IMotionEffect)
    {
    // Assign the motion effect values
    IMotionEffect motionEffect = (behavior as IMotionEffect);
    IMotionPath path = (motionEffect.Path as IMotionPath);
    path[0].IsRelative = false;
    break;
    }
    }
    // Save the presentation file
    ppDoc.Save("Sample.pptx");
    // Close the presentation file
    ppDoc.Close();
    'Create a new presentation
    Dim ppDoc As IPresentation = Presentation.Create()
    'Add a slide to the presentation.
    Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
    'Add shape on the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
    'Add animation effect on the slide with shape
    Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
    'Get the behaviors list from the effect
    Dim behaviors As IBehaviors = effect.Behaviors
    'Get behavior using foreach loop
    For Each behavior As IBehavior In behaviors
    'Check condition for behavior is motion effect
    If (TypeOf behavior Is IMotionEffect) Then
    'Assign the motion effect values
    Dim motionEffect As IMotionEffect = TryCast(behavior,IMotionEffect)
    Dim path As IMotionPath = TryCast(motionEffect.Path, IMotionPath)
    path(0).IsRelative = false
    Exit For
    End If
    Next
    'Save the presentation file
    ppDoc.Save("Sample.pptx")
    'Close the presentation file
    ppDoc.Close()

    Points

    Get the path values in points

    Declaration
    PointF[] Points { get; set; }
    Property Value
    Type
    System.Drawing.PointF[]
    Examples
    // Create a new presentation.
    IPresentation ppDoc = Presentation.Create();
    // Add a slide to the presentation.
    ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
    // Add shape on the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
    // Add animation effect on the slide with shape
    IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
    // Get the behaviors list from the effect
    IBehaviors behaviors = effect.Behaviors;
    // Get behavior using foreach loop
    foreach (IBehavior behavior in behaviors)
    {
    if (behavior is IMotionEffect)
    {
    // Assign the motion effect values
    IMotionEffect motionEffect = (behavior as IMotionEffect);
    IMotionPath path = (motionEffect.Path as IMotionPath);
    PointF[] points = path[0].Points;
    break;
    }
    }
    // Save the presentation file
    ppDoc.Save("Sample.pptx");
    // Close the presentation file
    ppDoc.Close();
    'Create a new presentation
    Dim ppDoc As IPresentation = Presentation.Create()
    'Add a slide to the presentation.
    Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
    'Add shape on the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
    'Add animation effect on the slide with shape
    Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
    'Get the behaviors list from the effect
    Dim behaviors As IBehaviors = effect.Behaviors
    'Get behavior using foreach loop
    For Each behavior As IBehavior In behaviors
    'Check condition for behavior is motion effect
    If (TypeOf behavior Is IMotionEffect) Then
    'Assign the motion effect values
    Dim motionEffect As IMotionEffect = TryCast(behavior,IMotionEffect)
    Dim path As IMotionPath = TryCast(motionEffect.Path, IMotionPath)
    Dim points As PointF() = path(0).Points  
    Exit For
    End If
    Next
    'Save the presentation file
    ppDoc.Save("Sample.pptx")
    'Close the presentation file
    ppDoc.Close()

    PointsType

    Get the points type value of motion effect

    Declaration
    MotionPathPointsType PointsType { get; set; }
    Property Value
    Type
    MotionPathPointsType
    Examples
    // Create a new presentation.
    IPresentation ppDoc = Presentation.Create();
    // Add a slide to the presentation.
    ISlide slide = ppDoc.Slides.Add(SlideLayoutType.Blank);
    // Add shape on the slide
    IShape shape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150);
    // Add animation effect on the slide with shape
    IEffect effect = ppDoc.Slides[0].Timeline.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick);
    // Get the behaviors list from the effect
    IBehaviors behaviors = effect.Behaviors;
    // Get behavior using foreach loop
    foreach (IBehavior behavior in behaviors)
    {
    if (behavior is IMotionEffect)
    {
    // Assign the motion effect values
    IMotionEffect motionEffect = (behavior as IMotionEffect);
    IMotionPath path = (motionEffect.Path as IMotionPath);
    path[0].PointsType = MotionPathPointsType.Auto;
    break;
    }
    }
    // Save the presentation file
    ppDoc.Save("Sample.pptx");
    // Close the presentation file
    ppDoc.Close();
    'Create a new presentation
    Dim ppDoc As IPresentation = Presentation.Create()
    'Add a slide to the presentation.
    Dim slide As ISlide = ppDoc.Slides.Add(SlideLayoutType.Blank)
    'Add shape on the slide
    Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Diamond, 150, 150, 250, 150)
    'Add animation effect on the slide with shape
    Dim effect As IEffect = ppDoc.Slides(0).TimeLine.MainSequence.AddEffect(shape, EffectType.PathCrescentMoon, EffectSubtype.None, EffectTriggerType.OnClick)
    'Get the behaviors list from the effect
    Dim behaviors As IBehaviors = effect.Behaviors
    'Get behavior using foreach loop
    For Each behavior As IBehavior In behaviors
    'Check condition for behavior is motion effect
    If (TypeOf behavior Is IMotionEffect) Then
    'Assign the motion effect values
    Dim motionEffect As IMotionEffect = TryCast(behavior,IMotionEffect)
    Dim path As IMotionPath = TryCast(motionEffect.Path, IMotionPath)
    path(0).PointsType = MotionPathPointsType.Auto
    Exit For
    End If
    Next
    'Save the presentation file
    ppDoc.Save("Sample.pptx")
    'Close the presentation file
    ppDoc.Close()
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved