Click here to Skip to main content
15,867,771 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two panels - panel2 and panelanimatoin. panelanimation is located on panel2. When i enter the area of panel, async method is activated. All is fine, but i can't uderstand, how to modificate code, that panelanimatoin goes back (return) after n-time (maybe after 5 seconds) to standart position (y : 1000, x: 0) and how to hold drop-position of panel ~ (y : 1000; x: 200) with radiobutton. Maybe it's easy -_-, but i'm broke.

public Form1()
        {
            InitializeComponent();
            panel2.MouseHover += panel2Hover;          
        }              
    public async void Animation_Async1()
    {
       
        int Height = panel2.Size.Height; // +10;
        while (panelanimatoin.Size.Height < Height) /
        {
            await Task.Delay(1); 
            panelanimatoin.Size = new Size(panelanimatoin.Width, panelanimatoin.Size.Height + 1); 
        }
      
    }   
        private void panel2Hover(object sender, EventArgs e)
        {
             Animation_Async1();
        }


What I have tried:

I have tried to read documentation about that, to analyze it, no result.
Posted
Updated 22-May-21 23:42pm

1 solution

Do you want the main panel to actually expand to reveal the second panel, or, do you want the main panel to remain the same size, but adjust the height of the first panel to reveal the second panel ?

Clarify what "animation" means, in this case.

I suggest you modify your design ... either:

1. put some small trigger UI-widget on the second panel that expands or collapses the second panel

or

2. have the second panel expand on some keyboard event in the host panel, then, perhaps, have it collapse when the user sets focus on some other Control ... i.e. in the 'Leave event of the dropdown.

I would not appreciate a panel expanding and then collapsing after some fixed interval ... however, I understand that is a design used by some Toast/Notify UI's.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900