How to | Create a User Interface Using .NET/Link
.NET/Link lets you write sophisticated user interfaces by calling .NET types directly from the Wolfram Language. Doing so allows you to evaluate code as you add it, either one or multiple lines at a time, much like when writing a program in the Wolfram Language. This results in an extremely powerful development environment that allows you to experiment with your user interface while it is running.
You must load the .NET/Link package before you can use .NET/Link (which can only be loaded on the Windows platform):

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-tt4
Use InstallNET to launch the .NET runtime:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-pyv
Start off by creating a Windows Form, that is, a "window"; you can add controls such as menus to such a form:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-b1c85g

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-ecqsik
Now the form appears. Watch what happens when the following properties are set for the width, height, and title:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-eqtlj6

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-imut9m

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-ctvxqz
You have just set standard .NET properties, much as you would in C# or Visual Basic. However, unlike these programming languages, the changes appear immediately in the window.
Next, create a Rich Text (RTF) box to enter and display text. This will later be added to the form:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-i2yei
Set its default font family and font size:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-pl4f2
You will now dock the RTF box to the form.
First, load the .NET DockStyle type:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-b7rsth
Dock the RTF box to the edges of the form, with the DockStyle set to Fill. This makes the RTF box fill the form, regardless of how the form is resized:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-n3ttre

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-gacejk

Next, make some menu items and add them to the form.

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-lsku37

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-vruzl
Add the Save As menu item to the File menu item:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-nzl6nw
Make menu items for selecting the font type and text color:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-hdxo2s

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-nu869

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-ewha0
Add the Select Font and Select Text Color menu items to the Format menu item:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-sipyk
Make a main menu and add the File and Format menu items to it:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-e2fsv1
Add the main menu to the form:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-cp9ndg

You must now specify how the events, in this case clicking the specific menu items, will be handled.
Clicking the Save As menu item will open a file browser to save a rich or plain text document:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-g326wi

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-fz1wey
Clicking the Select Font menu item calls the Windows Font dialog when text is selected:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-e3hge

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-f4r93t

Similarly, clicking the Select Text Color menu item opens the Windows Color dialog box when text is selected:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-m4adt

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-jen20h

You can now type and format text in the form.
You can also set the form to display some initial text:

https://wolfram.com/xid/0gle6dimjvv8u1ccahqe17yobyd6bchiaof5ju-kck31b
In the form, choose Format ▶ Select Font, and display some parts of the text in bold or italics. Choose Format ▶ Select Text Color to add color to the text:

The file can now be saved by choosing File ▶ Save As in the form:
