隐藏带有动画的面板不起作用

Hiding panel with animation is not working

我正在使用 C# 开发一个项目,在使用 (BunifuTransition) 框架隐藏面板时遇到问题。 所以基本上我有很多按钮(菜单按钮)和一个带有按钮的子面板(子菜单),我遇到了这个问题...

所以在这里您可以看到“显示和隐藏”面板可以很好地处理所有单击的按钮... Working fine in here

但是,当我尝试通过单击显示它的同一个按钮来关闭同一个面板时,发生了以下情况... The panel closes but without Bunifu Animator

这是你需要知道的代码

        private void HideSubMenu() //Method to hide the subpanles (BunifuAnimator)
    {  
        if (PanelOtherRulesSubMenu.Visible == true)
            PanelSubMenuAnimation.HideSync(PanelOtherRulesSubMenu);
    }
                      --------------
        private void ShowSubMenu(Panel Submenu) //Method to show the subpanels
    {
        if (PanelOtherRulesSubMenu.Visible == false)
            PanelSubMenuAnimation.ShowSync(PanelOtherRulesSubMenu);

        if (Submenu.Visible == false)
        {
            HideSubMenu();
            Submenu.Visible = true;
        }
        else
            Submenu.Visible = false;

在这里你可以看到所有的按钮都被调用来隐藏子面板,除了“其他规则”,它被调用来显示带有一些条件的子面板......

        private void btnGovermentRules_Click(object sender, EventArgs e)
    {
        HideSubMenu();
    }

    private void GangRules_Click(object sender, EventArgs e)
    {
        HideSubMenu();
    }

    private void btnBusinessRules_Click(object sender, EventArgs e)
    {
        HideSubMenu();
    }

    private void btnBuildingRules_Click(object sender, EventArgs e)
    {
        HideSubMenu();
    }
    private void btnSubMenuOR_Click(object sender, EventArgs e) //here is the button invoked to show the panel
    {
        ShowSubMenu(PanelOtherRulesSubMenu); 
    }

现在,伙计们,我需要你们帮助使关闭动画在单击“btnSubMenuOR_Click”按钮关闭子面板时也能正常工作。 谢谢,

问题已解决!我只是尝试删除并替换一些代码行,如下所示,来自:

        private void ShowSubMenu(Panel Submenu) //Method to show the subpanels
{
    if (PanelOtherRulesSubMenu.Visible == false)
        PanelSubMenuAnimation.ShowSync(PanelOtherRulesSubMenu);

    if (Submenu.Visible == false)
    {
        HideSubMenu();
        Submenu.Visible = true;
    }
    else
        Submenu.Visible = false;

对此:

        private void ShowSubMenu(Panel Submenu)
    {
        if (PanelOtherRulesSubMenu.Visible == false)
            PanelSubMenuAnimation.ShowSync(PanelOtherRulesSubMenu);
        else
            PanelSubMenuAnimation.HideSync(PanelOtherRulesSubMenu);
    }