I have a Panel In my C# form and I have a button. When I click on the Button the invisible Panel Shows. Instead of that I want the Panel to move in or slide in. For example when you click on a combobox the dropdown list doesnt just pop in. I want my Panel to appear like that. How can I do that ?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
If you are using .NET 4 (if not replace Task with Thread), a function similar to this could be a start:
Usage:
As action you would send some boolean variable to set to true so that you know that the animation has finished or some code to run after it. Beware of deadlocks when calling with a null action. You could run two animations on the same control in two different directions with the same speed, and it will stay where it was forever and of course two animations simultaneusly can make the control go infinitely in some direction because the while will never finish :)
For WinForms, you could start with the Panel location being off screen.
Employ a Timer, and in the Tick event, shift the Panel's location slowly into view until it is at your predefined coordinates.
Lots of ways to skin a cat, but this is how I'd do it.
Check out the library I wrote last year:
https://falahati.github.io/WinFormAnimation/
This moves the
c_control
control from -100, -100 to the location it was in first place in 500 ms.Window animation is a built-in feature for Windows. Here's a class that uses it:
Sample usage: