2013-07-20 69 views
0

基本上我的問題是如何在特定幀停止GIF。如何在特定幀中停止GIF在winfoms中

我有一個已經設置了圖像的GIF圖片框和我創建了一個2個事件EnterLeave

private void pictureBox1_MouseEnter(object sender, EventArgs e) 
    { 
     pictureBox1.Image = Properties.Resources.LOGODEFAULT1; 
    } 
    private void pictureBox1_MouseLeave(object sender, EventArgs e) 
    { 
     pictureBox1.Image = Properties.Resources.LOGOLEAVE1; 
    } 

我想是停止在最後一幀的GIF(所有的gif文件包括7幀) 我試過ImageAnimator和ImageStop

private void pictureBox1_MouseEnter(object sender, EventArgs e) 
    { 
     ImageAnimator.Animate(pictureBox1.Image, OnFrameChanged1); 
    } 
    private void pictureBox1_MouseLeave(object sender, EventArgs e) 
    { 
     ImageAnimator.StopAnimate(pictureBox1.Image, OnFrameChanged2); 
    } 
    private void OnFrameChanged1(object sender, EventArgs e) 
    { 
     pictureBox1.Image = Properties.Resources.LOGODENTER; 
    } 
    private void OnFrameChanged2(object sender, EventArgs e) 
    { 
     pictureBox1.Image = Properties.Resources.LOGOLEAVE1; 
    } 
+0

怎麼樣創建所有的7幀,然後自己動畫? – Sorashi

+0

我認爲這會導致長代碼? – Miki

回答