If you need to change the size of the form, you can modify its width and height properties and use a loop to make it an animation.
for (int i = 0; i < 20; i++)
{
this.Height -= 7;
this.Width -= 10;
Thread.Sl*eep(10);
}
You can also consider using WPF, which has rich animation effects.
<Grid>
<Button Content="Click" Width="100" Height="30">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard >
<Storyboard RepeatBehavior="Forever" AutoReverse="False">
<DoubleAnimation Storyboard.TargetName="myWindow"
Storyboard.TargetProperty = "(Window.Height)"
To="300" Duration="0:0:5"/>
<Storyboard RepeatBehavior="Forever" AutoReverse="False">
<DoubleAnimation Storyboard.TargetName="myWindow"
Storyboard.TargetProperty = "(Window.Width)"
To="300" Duration="0:0:5"/>
</Storyboard>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</Grid>
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.