如何创build一个Excel AddIn使用的对话框?

我熟悉Excel AddIns的基础知识,但不知道如何devise,实现和稍后显示一个内部对话框

在这里看到站立的问题与图像:

https://social.msdn.microsoft.com/Forums/en-US/935ebeae-1b88-4609-ba33-b0e522d2797f/how-to-create-a-dialog-for-use-by-an-excel-addin?论坛= exceldev

TIA

笔记:

(1)我的编程语言是C#

(2)我更喜欢通过绘制它们来devise对话框。

您可以使用MessageBox类,例如:

const string message = "Are you sure that you would like to close the form?"; const string caption = "Form Closing"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { // cancel the closure of the form. e.Cancel = true; } 

如果要自行定制对话窗口,可以将新的Windows窗体添加到项目中,然后添加所需的控件。 在代码中创build窗体的实例后,可以使用Show或ShowDialog方法显示它。