How can I create a Settings dialog for a Word Addin.
I have already creating a Windows Form
and I'm calling 'form.Show()`. But It's creating a new Window.
How can I pass the owner by form.ShowDialog(owner)
?
I've solve my question creating a Helper for open the Dialog, but I don't know if is the best way
public static DialogResult ShowDialog(Form dialog)
{
NativeWindow mainWindow = new NativeWindow();
mainWindow.AssignHandle(Process.GetCurrentProcess().MainWindowHandle);
DialogResult dialogResult = dialog.ShowDialog(mainWindow);
mainWindow.ReleaseHandle();
return dialogResult;
}
Box simply click the Home tab in the ribbon. And then click the paragraph dialogue box launcher button in the lower right corner of the paragraph.
To create a new dialog box In Resource View, right-click your . rc file and select Add Resource. In the Add Resource dialog box, select Dialog in the Resource Type list, then choose New. If a plus sign (+) appears next to the Dialog resource type, it means that dialog box templates are available.
A: A dialog box is a small window that a program pops open to request input from the user. For example, in Word if you click on the Save icon and the document hasn't already been named, Word will pop open a dialog box that prompts you to name the file and tell the program where to save it.
I solve the question creating the code:
public static DialogResult ShowDialog(Form dialog)
{
NativeWindow mainWindow = new NativeWindow();
mainWindow.AssignHandle(Process.GetCurrentProcess().MainWindowHandle);
DialogResult dialogResult = dialog.ShowDialog(mainWindow);
mainWindow.ReleaseHandle();
return dialogResult;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With