9using System.Collections.Generic;
10using System.ComponentModel;
15using System.Windows.Forms;
22 [ToolboxItem(
true), ToolboxBitmap(typeof(BusyAnimation),
"Csla.Windows.BusyAnimation")]
30 InitializeComponent();
31 this.SetStyle(ControlStyles.SupportsTransparentBackColor,
true);
32 this.BusyProgressBar.GetType().GetMethod(
"SetStyle", System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.IgnoreCase).Invoke(this.BusyProgressBar,
new object[] { ControlStyles.SupportsTransparentBackColor,
true });
34 this.BusyProgressBar.BackColor = _progressBarBackColor;
37 private Color _progressBarForeColor = System.Drawing.Color.LawnGreen;
42 [Description(
"Foreground color for busy animation's progress bar.")]
43 [DefaultValue(typeof(System.Drawing.Color),
"LawnGreen")]
49 return _progressBarForeColor;
53 _progressBarForeColor = value;
54 this.BusyProgressBar.ForeColor = _progressBarForeColor;
59 private Color _progressBarBackColor = System.Drawing.Color.White;
64 [Description(
"Background color for busy animation's progress bar.")]
65 [DefaultValue(typeof(System.Drawing.Color),
"White")]
71 return _progressBarBackColor;
75 _progressBarBackColor = value;
76 this.BusyProgressBar.BackColor = _progressBarBackColor;
80 private bool _isRunning =
false;
86 [Description(
"Indicates if animation needs to be shown. Set to true to start progress bar animation")]
103 private void Run(
bool run)
108 this.BusyProgressBar.Visible = run;
109 this.ProgressTimer.Enabled = run;
114 private void ProgressTimer_Tick(
object sender, EventArgs e)
118 int newValue = this.BusyProgressBar.Value + this.BusyProgressBar.Step;
119 if (newValue > this.BusyProgressBar.Maximum)
121 this.BusyProgressBar.Value = 0;
125 this.BusyProgressBar.Value = newValue;
130 private bool IsInDesignMode
134 if (this.GetService(typeof(System.ComponentModel.Design.IDesignerHost)) !=
null)
141 private void BusyAnimation_Load(
object sender, EventArgs e)
145 this.BusyProgressBar.Value = (int)(this.BusyProgressBar.Maximum / 2);
146 this.BusyProgressBar.Visible =
true;
User control that displays busy animation
Color ProgressBarForeColor
Set or get foreground color for busy animation's progress bar
Color ProgressBarBackColor
Set or get background color for busy animation's progress bar
bool IsRunning
Indicates if animation needs to be shown.
BusyAnimation()
new instance busy animation