簡體   English   中英

如何將窗體窗口的所有者設置為 WPF Window?

[英]How can I set Form Window's owner to WPF Window?

我的應用程序構建在 WPF .NET 框架中。

我有一個 WPF MainWindow,我想將幾個 FormWindows 作為 WPF MainWindow 的子窗口。 When making child WPF Window of parent WPF Window, I can simply put Owner = this to child window but it does not work on Form Window, of course.

有沒有辦法讓它成為可能?

提前致謝

不,您不能將 WPF window 的Owner屬性設置為除另一個 WPF Z05B8C74CBD9706FBF2FZ4C1 之外的任何其他內容。

WindowInteropHelper class 有一個Owner屬性,可以設置為表單的 HWND:

Form1 form = new Form1();
WindowInteropHelper wih = new WindowInteropHelper(wpfWindow);
wih.Owner = form.Handle;

另一個建議是跳過 forms 並將 forms 的內容移動到 WPF Z0F4137ED1502B5045D6083A2中,例如使用 Windows8FormsBHostCAA2 控件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM