WinForm 창 페이드 효과 인터페이스의 간단한 실현 방법

1639 단어 WinForm
WinForm 창 페이드 효과는 주로 컨트롤의 Opacity 속성에 사용됩니다.
먼저 WinForm 창에서 Timer 컨트롤을 드래그한 다음 Timer 컨트롤의 Tick 이벤트에 다음 코드를 추가합니다.
private void timer1_Tick(object sender, EventArgs e)
{
    if (this.Opacity < 1)
    {
        this.Opacity = this.Opacity + 0.08;
    }
    else
    {
        this.timer1.Enabled = false;
    }
}

 
Form 창의 Load 이벤트에서 Opacity 속성의 초기 값을 0으로 설정합니다.
private void Form1_Load(object sender, EventArgs e)
{
    this.timer1.Enabled = true;
    this.Opacity = 0;
}

이렇게 간단한 페이드 효과를 실현할 수 있다

좋은 웹페이지 즐겨찾기