1.
Copy codeThe Code is as follows: 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.Copy codeThe Code is as follows: private void timerjavastick (object sender, System. EventArgs e)
{
This. Opacity = WinShow;
WinShow ++ = 0.1;
If (WinShow> = 1)
{
Timer1.Dispose ();
}
}
3. Use a cycle or timer,
Copy codeThe Code is as follows: frmForm myForm = new frmForm ()
FrmForm. Opacity = 0;
FrmForm. show ();
For (int I = 0; I <100; I ++)
{
Application. DoEvents ()
FrmForm. Opacity = I/100;
}
4.Copy codeThe Code is as follows: # region ******** form fade-in effect function ********
Private double WinShow = 0; // variable used for window fade-in effect
Private void FormShow (System. Windows. Forms. Form Curfrm)
{
Curfrm. Opacity = WinShow;
WinShow ++ = 0.01;
If (WinShow = 1)
{
Curfrm. timerShow. Stop ();
}
}
# Endregion
# Region ******** example of function calling for form fade-in effect ********
// Implement the fade-in effect of the window
Private void timerShow_Tick (object sender, System. EventArgs e)
{
// TimerShow, which is the name of the timer control. Set timerShow. interval to 100.
FormShow (this );
}
# Endregion