隐藏动画的面板不起作用

问题描述 投票:0回答:1

我正在使用C#开发一个项目,并且在隐藏具有(BunifuTransition)框架的面板时出现了问题。所以基本上我有很多按钮为(Menu Buttons)和一个子面板的按钮为(submenu),我遇到了这个问题...

所以在这里您可以看到显示和隐藏面板与所有单击的按钮都可以正常工作...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]按钮关闭子面板时,使关闭动画也能正常工作。谢谢,

c# visual-studio animation windows-forms-designer bunifu
1个回答
0
投票

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

        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);
    }
© www.soinside.com 2019 - 2024. All rights reserved.