What is the event used to detect a WinForms XPTaskBar animation?
Animation events
The following events can be subscribed to detect an XPTaskBarBox animation.
1. BeforeAnimation
2. AfterAnimation
BeforeAnimation - This event is fired before the XPTaskBarBox expands and collapses.
AfterAnimation - The event is fired after the XPTaskBarBox expands and collapses.
C#
//Raises the BeforeAnimation event. this.xpTaskBarBox1.BeforeAnimation += new EventHandler(xpTaskBarBox1_BeforeAnimation); //Raises the AfterAnimation event. this.xpTaskBarBox1.AfterAnimation += new EventHandler(xpTaskBarBox1_AfterAnimation); //The event is raised before the TaskBarBox expands and collapses. void xpTaskBarBox1_BeforeAnimation(object sender, EventArgs e) { this.richTextBox1.AppendText("\n Before Animation fired on XPTaskBarBox1"); } //The event is raised after the TaskBarBox expands and collapses. void xpTaskBarBox1_AfterAnimation(object sender, EventArgs e) { this.richTextBox1.AppendText("\n After Animation fired on XPTaskBarBox1"); }
VB
'Raises the BeforeAnimation event. AddHandler xpTaskBarBox1.BeforeAnimation, AddressOf xpTaskBarBox1_BeforeAnimation 'Raises the AfterAnimation event. AddHandler xpTaskBarBox1.AfterAnimation, AddressOf xpTaskBarBox1_AfterAnimation 'The event is raised before the TaskBarBox expands and collapses. Private Sub xpTaskBarBox1_BeforeAnimation(ByVal sender As Object, ByVal e As EventArgs) Me.richTextBox1.AppendText(Constants.vbLf & " Before Animation fired on XPTaskBarBox1") End Sub 'The event is raised after the TaskBarBox expands and collapses. Private Sub xpTaskBarBox1_AfterAnimation(ByVal sender As Object, ByVal e As EventArgs) Me.richTextBox1.AppendText(Constants.vbLf & " After Animation fired on XPTaskBarBox1") End Sub
You would typically do this when you have to resize your form (or some other control in the form) based on the current size of the XPTaskBar control.
Figure 1: Before firing XPTaskBarBox animation event
Figure 2: After firing XPTaskBarBox animation event
Samples:
Reference link: https://help.syncfusion.com/windowsforms/xptaskbar/xptaskbar-events