We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Need to perform animation in Diagram nodes

Platform: WinForms |
Control: Diagram |
Published Date: November 25, 2015 |
Last Revised Date: June 2, 2019

Perform animation in Diagram nodes:

In Syncfusion Diagram the animation can be achieved by customizing the node.

The below code shows how to create animation in diagram nodes:

[C#]

public float VolumeLevel
{
   get {return m_fVolumeLevel;}
   set
     {
        if (m_fVolumeLevel != value && OnPropertyChanging(this.FullContainerName, "VolumeLevel", value))
        {
            RecordPropertyChanged("VolumeLevel");
            if (value > 80)
               value = 20;
            if (value < 20)
               value = 80;
            // set new value
            m_fVolumeLevel = value;
            // raise property changed event to rendering the node
            OnPropertyChanged(this.FullContainerName, "VolumeLevel");
         }
     }
}

 

[VB]

Public Property VolumeLevel() As Single
Get
   Return m_fVolumeLevel
End Get
Set(ByVal value As Single)
   If m_fVolumeLevel <> value AndAlso OnPropertyChanging(Me.FullContainerName, "VolumeLevel", value) Then
 RecordPropertyChanged("VolumeLevel")
 If value > 80 Then
          value = 20
 End If
 If value < 20 Then
    value = 80
 End If
 ' set new value
 m_fVolumeLevel = value
 ' raise property changed event
 OnPropertyChanged(Me.FullContainerName, "VolumeLevel")
    End If
End Set
End Property

 

TimerInterval

This property is used to create alerts. Each time it triggers based on an interval period.

[C#]

//initializing alert timer
alertTimer = new System.Windows.Forms.Timer();
//initializing interval period value of alert timer
alertTimer.Interval = 2500;
 
public int TimerInterval
{
   get { return alertTimer.Interval; }
   set
     {
        if (alertTimer.Interval != value)
        {
           alertTimer.Interval = value;
        }
     }
}

 

[VB]

'initializing alert timer
alertTimer = New System.Windows.Forms.Timer()
' initializing interval period value of alert timer
alertTimer.Interval = 2500
 
Public Property TimerInterval() As Integer
Get
      Return alertTimer.Interval
End Get
Set(ByVal value As Integer)
 If alertTimer.Interval <> value Then
  alertTimer.Interval = value
 End If
End Set
End Property

 

EnableTimer

This property can used to implement a simple interval timer, which sets off an alarm every interval periods. If the interval is set after the timer has started, the count will be reset to 0. 

[C#]

alertTimer.Enabled = true;
 
public bool EnableTimer
{
      get { return alertTimer.Enabled; }
      set
      {
            if (alertTimer.Enabled != value)
            alertTimer.Enabled = value;
      }
}

 

[VB]

alertTimer.Enabled = True
 
Public Property EnableTimer() As Boolean
Get
    Return alertTimer.Enabled
End Get
Set(ByVal value As Boolean)
    If alertTimer.Enabled <> value Then
 alertTimer.Enabled = value
    End If
 End Set
End Property

 

alertTimer_Tick() Event :

This event can be used to change the value of “VolumeLevel”. The event triggering is based on the value of interval period which is given by the user.

[C# ]

//Registering Event
alertTimer.Tick += new EventHandler(alertTimer_Tick);  
 
void alertTimer_Tick(object sender, EventArgs e)
{
   //Change the value of VolumeLevel each time the event is called
   this.VolumeLevel = VolumeLevel - 5;         
}

 

[VB]

' Registering Event
AddHandler alertTimer.Tick, AddressOf alertTimer_Tick
 
Private Sub alertTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)
     Me.VolumeLevel = VolumeLevel - 5
End Sub

 

Please refer the below attached sample.

Sample

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon