How to find the control visibility when the AutoHideAnimation starts in WinForms Docking Manager?
Visibility of DockingManager
In WinForms Docking Manager, the control visibility can be determined by handling the event named AutohideAnimationStart event.
If the control is autohidden before the animation starts, then the size of the display rectangle will be empty. Hence by ensuring the size of the display rectangle the visibility of the control can be determined in the AutoHideAnimationStart event. The following code example demonstrates the same.
C#
void dockingManager1_AutoHideAnimationStart(object sender, Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs arg)
{
//Calculating display rectangle to determine whether RollState is In or Out
DockHost dh = arg.Control.Parent as DockHost;
if (dh.DisplayRectangle != Rectangle.Empty)
arg.RollState = AutoHideRollState.RolledIn;
else
arg.RollState = AutoHideRollState.RolledOut;
if (arg.RollState == Syncfusion.Windows.Forms.Tools.AutoHideRollState.RolledIn)
{
Debug.WriteLine("Control Visibility : Visible");
}
else
{
Debug.WriteLine("Control Visibility : Hidden");
}
}
VB
Private Sub dockingManager1_AutoHideAnimationStart(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs)
'Calculating display rectangle to determine whether RollState is In or Out
Dim dh As DockHost = TryCast(arg.Control.Parent, DockHost)
If dh.DisplayRectangle <> Rectangle.Empty Then
arg.RollState = AutoHideRollState.RolledIn
Else
arg.RollState = AutoHideRollState.RolledOut
End If
If arg.RollState = Syncfusion.Windows.Forms.Tools.AutoHideRollState.RolledIn Then
Debug.WriteLine("Control Visibility : Visible")
Else
Debug.WriteLine("Control Visibility : Hidden")
End If
End Sub
Samples:
C#: https://www.syncfusion.com/downloads/support/directtrac/general/AUTOHI~11716454616.ZIP
VB: https://www.syncfusion.com/downloads/support/directtrac/general/ze/AutoHideVisibility_VB-209878711