【问题标题】:Hiding panel with animation is not working带有动画的隐藏面板不起作用
【发布时间】:2020-05-04 21:14:55
【问题描述】:

我正在使用 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”按钮关闭子面板时帮助制作关闭动画。 谢谢,

【问题讨论】:

    标签: c# visual-studio animation windows-forms-designer bunifu


    【解决方案1】:

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

            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);
        }
    

    【讨论】:

      猜你喜欢
      • 2021-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多