using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
public class MainWindow : Window
{
Button btn = new Button();
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainWindow());
}
public MainWindow()
{
btn.Content = "Expanding Button";
btn.FontSize = 12;
btn.HorizontalAlignment = HorizontalAlignment.Center;
btn.VerticalAlignment = VerticalAlignment.Center;
btn.Click += ButtonOnClick;
Content = btn;
}
void ButtonOnClick(object sender, RoutedEventArgs args)
{
DispatcherTimer tmr = new DispatcherTimer();
tmr.Interval = TimeSpan.FromSeconds(0.1);
tmr.Tick += TimerOnTick;
tmr.Start();
}
void TimerOnTick(object sender, EventArgs args)
{
btn.FontSize += 2;
if (btn.FontSize >= 48)
{
btn.FontSize = 12;
(sender as DispatcherTimer).Stop();
}
}
}