C#實現(xiàn)窗體淡入淡出效果的方法總結(jié)
更新時間:2013年05月20日 10:36:22 作者:
C#實現(xiàn)窗體淡入淡出效果的方法總結(jié),需要的朋友可以參考一下
1.
復(fù)制代碼 代碼如下:
private void Form1_Load(object sender, System.EventArgs e)
for(double d=0.01; d< 1; d+=0.02)
{
System.Threading.Thread.Sleep(1);
Application.DoEvents();
this.Opacity=d;
this.Refresh();
}
2.
復(fù)制代碼 代碼如下:
private void timer1_Tick(object sender, System.EventArgs e)
{
this.Opacity = WinShow ;
WinShow += 0.1 ;
if(WinShow >=1 )
{
timer1.Dispose ();
}
}
3.用循環(huán)或計時器,
復(fù)制代碼 代碼如下:
frmForm myForm=new frmForm()
frmForm.Opacity=0;
frmForm.show();
for(int i=0;i<100;i++)
{
Application.DoEvents()
frmForm.Opacity=i/100;
}
4.
復(fù)制代碼 代碼如下:
#region ******** 窗體淡入效果函數(shù) ********
private double WinShow = 0;//用于窗口淡入效果的變量
private void FormShow(System.Windows.Forms.Form Curfrm)
{
Curfrm.Opacity = WinShow ;
WinShow += 0.01;
if(WinShow == 1)
{
Curfrm.timerShow.Stop ();
}
}
#endregion
#region ******** 窗體淡入效果函數(shù)調(diào)用示例 ********
//實現(xiàn)窗口的淡入效果
private void timerShow_Tick(object sender, System.EventArgs e)
{
//timerShow,這是一個timer控件名稱;把timerShow.interval=100就可以了。
FormShow(this);
}
#endregion
相關(guān)文章
C#把EXCEL數(shù)據(jù)轉(zhuǎn)換成DataTable
這篇文章介紹了C#把EXCEL數(shù)據(jù)轉(zhuǎn)換成DataTable的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-04-04C#操作SQLite數(shù)據(jù)庫之讀寫數(shù)據(jù)庫的方法
這篇文章主要介紹了C#操作SQLite數(shù)據(jù)庫之讀寫數(shù)據(jù)庫的方法,簡單分析了C#針對SQLite數(shù)據(jù)庫的讀寫及顯示等操作相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2016-07-07