我无法在我的 C# wpf 项目上发送消息,我已经导入了所有组件,但现在收到此错误MessageBoxButtons 出现错误“无法将 system.windows.forms.messageboxbuttons 转换为 system.windows.messageboxbuttons”using System.Windows;using System;using System.Windows.Controls;using System.Drawing;using System.Drawing.Imaging;using System.Security;using MessageBox = System.Windows.MessageBox;using System.Text.RegularExpressions;using System.IO;using System.Collections.Generic;using System.Windows.Forms; if (MessageBox.Show("test", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { // user clicked yes } else { // user clicked no }
1 回答
SMILET
TA贡献1796条经验 获得超4个赞
你混合了 WPF/Winforms
为按钮/图像使用正确的名称空间:
if (MessageBox.Show("test", "Confirm", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Question) == MessageBoxResult.Yes)
{
// user clicked yes
}
else
{
// user clicked no
}
- 1 回答
- 0 关注
- 207 浏览
添加回答
举报
0/150
提交
取消