如何在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