简体   繁体   中英

How to create a dialog for use by an Excel AddIn?

I am familiar with the basics of Excel AddIns, but have no idea how to design, implement and later display an internal dialog .

See standing question with images here:

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

TIA

Notes:

(1) My programming language is C#

(2) I prefer to design dialogs by drawing them.

You can use the MessageBox class, for example:

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;
}

If you want to customize the dialog window on your own, you can add a new Windows Form to the project and then add the required controls. After creating an instance of the form in the code you may show it using the Show or ShowDialog methods.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM