2010-12-07 72 views
0

當我調用「this.close()」傳遞到另一個頁面。關閉的效果,並顯示一秒鐘沒有頁面。我該如何解決這個問題?WPF - 如何刪除「this.close()」效果?

例如:


Game game = new Game(); 
game.show(); 
this.close(); 

當我打電話this.close(),用於第二,沒有顯示的頁面的效果。我想和實現類似的瀏覽器。

+0

我不知道你的問題是有道理的。你可以編輯更好地解釋你的問題? – 2010-12-07 17:21:20

回答

1

在Windows 7中,Aero效果會導致窗口在顯示和關閉時淡入和淡出。這是我繼承開發中的一個應用程序的一個問題,我解決了我的問題,不再使用單獨的表單來簡單地在屏幕上替換對方。我的WPF經驗是有限的,所以你可能必須解釋我的解決方案:

我將程序中的所有表單對象轉換爲單獨的UserControls。 我的基本形式有一個看起來有點像這樣的活動屏幕特性:

// Code is untested 
public Control ActiveScreen 
{ 
    get { return _screen; } 
    private set 
    { 
     this.Controls.Remove(_screen); 
     _screen = value; 
     _screen.Dock = DockStyle.Fill; 
     _screen.Size = this.ClientRectangle.Size; // So that control draws correctly the first time. 
     this.Controls.Add(_screen); 
    } 
} 

做一個快速搜索後,一定會有別的方式來解決Aero的效果: Disable aero fade-in effect on dialog