為什麽WPF窗口在這種模式下更改窗口的寬度和高度沒有作用呢?
下面是代碼:
public MainWindow()
{
InitializeComponent();
//this.TopMost = true;
this.Topmost = true;
this.ShowInTaskbar = true;
this.ResizeMode = ResizeMode.CanResize;
this.Height = System.Windows.Forms.SystemInformation.VirtualScreen.Height;
this.Width = System.Windows.Forms.SystemInformation.VirtualScreen.Width;
}
private void ResetWndSize(object sender, EventArgs e)
{
//this.Height = System.Windows.Forms.SystemInformation.VirtualScreen.Height;
//this.Width = System.Windows.Forms.SystemInformation.VirtualScreen.Width;
}
private void ResetWindowSizeBtn(object sender, RoutedEventArgs e)
{
this.Height = System.Windows.Forms.SystemInformation.VirtualScreen.Height;
this.Width = System.Windows.Forms.SystemInformation.VirtualScreen.Width;
}
另外,如果想要壹個wpf desktop應用程序顯示在windows8 start頁面之上可以按照如下步驟:
1 創建壹個wpf應用程序
2 將topmost和showintaskbar屬性都設置為true
3 為應用程序添加mainfest文件並將uiAccess='true'
4 編譯程序
5 打上數字簽名
6 將程序拷貝到系統盤program file目錄下
7 運行程序
8 切換到windows8 start頁面,此時會發現您的程序會顯示在其上,如帖子中圖片所示。