如何在WPF中使用WIndows Forms?如何在WPF中使用WIndows Forms?
在我的WPF程序中,我創建了一個Windows窗體類。 在這個表單中,我放置了一個OK按鈕,然後進入按鈕的屬性並將DialogResult設置爲OK。現在 ,我從MainWindow.xaml.cs調用這個對話框(窗口形式):
DialogResult dres;
dres = form.ShowDialog();
if (dres != DialogResult.OK) return;
編譯器抱怨:
Error 3 'System.Nullable<bool>' does not contain a definition for 'OK' and no extension method 'OK'
accepting a first argument of type 'System.Nullable<bool>' could be found (are you missing a using directive
or an assembly reference?)
第一次出現不需要更改,但第二次出現需要;編譯器在這裏找到該類的DialogResult屬性而不是DialogResult枚舉。 – 2010-05-26 19:43:55