????C#???WinForm?????????Ч?????????????????????????????????????????????????????????????????0??1???????????????????????????????????????????·??????????????????????????????????????????????????????????Ч???????????£?
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace TEMS.Forms
{
public partial class FormBase : Form
{
private Timer formTimer = null;
/// <summary>
/// ???Opacity????
/// </summary>
[DefaultValue(0)]
[Browsable(false)]
public new double Opacity
{
get { return base.Opacity; }
set { base.Opacity = 0; }
}
public FormBase()
{
InitializeComponent();
formTimer = new Timer() { Interval = 100 };
formTimer.Tick += new EventHandler(formTimer_Tick);
base.Opacity = 0;
}
private void formTimer_Tick(object sender?? EventArgs e)
{
if (this.Opacity >= 1)
{
formTimer.Stop();
}
else
{
base.Opacity += 0.2;
}
}
private void FormBase_Shown(object sender?? EventArgs e)
{
formTimer.Start();
}
}
}