Programming in Visual C++/CLR 2012
Creating a Windows form application
How to use Visual Studio 2015 is explained at this
website.
You can create a new windows form application in
Visual C++/CLR 2013 essentially in the same way as explained below.
A simple graphics program is prepared at this website.
How to use GUI components of Visual C++/CLR is
explained at this website.
How to copy a form is explained at this website.
Creating a new windows form application in Visual C++/CLR (.NET programming) consists of the following three steps:
1. Prepare a new form.
2. Write simple codes to present the form.
3. Set project properties to disable the console window (optional).
The three steps are explained below.
1.
Prepare
a form.
Start Visual Studio 2012, and select the menu gFILE|New Projecth(Figure 1).

Figure 1
The new project dialog box will appear (Figure 2). Select the template gVisual C++|CLR|CLR Empty Projecth.

Figure 2
If you want to change the Name, Location or Solution name, you can set them as you like.
Click OK button, then the new project will be created (Figure 3). Select the menu gPROJECT|Add New Itemh.

Figure 3
gAdd New Itemh window will be presented (Figure 4). Select item gVisual C++|UI|Windows Formh and click Add button.

Figure 4
Form designer window will be presented (Figure 5).
If you want to add some components on the form, click Toolbox tab.

Figure 5
Click the lying pin (Figure 6).

Figure 6
The form designer window will be reappear (Figure 7).
If you want to put a button on the form, copy the Button on the form by click and drag. Double click the button on the form to prepare an event handler.

Figure 7
Event handler button1_Click will be automatically prepared (Figure 8).

Figure 8
In Figure 9, gthis->Close();h is inserted, so the form will be closed when the button is clicked.

Figure 9
2.
Write
simple codes to present the form.
Select the menu gPROJECT|Add New Itemh. gAdd New Itemh window will appear (Figure 10).

Figure 10
Choose the template gVisual C++|Code|C++ File (.cpp)h, then click Add button. The source code file will be prepared (Figure 11).

Figure 11
Write the following codes (Figure 12):
#include "MyForm.h" // The header file of the form
using namespace Project1; // The name of the namespace in MyForm.h
[STAThreadAttribute] // Run this program in STA mode
int main(){
MyForm fm; // The form to be created and shown
fm.ShowDialog(); // Show the form
return 0;
}

Figure 12
The included file gMyForm.hh, namespace gProject1h and ref class name gMyFormh correspond to those for the window form to be presented (Figure 13).

Figure 13
After you finished the above work, click gBUILD|Build Solutionh menu (Figure 14).

Figure 14
If Build succeeded (Figure 15), then press the function key F5 to run the program.

Figure 15
A console window will appear (Figure 16).

Figure 16
Then the form will appear (Figure 17).

Figure 17
3. Set project properties to disable the console window.
If you donft want the console window to appear, set the two properties of the project, SubSystem and Entry Point, as follows.
Click menu gPROJECT|(project name) Propertiesh (Figure 18).

Figure 18
Property Pages window will appear (Figure 19). Select gConfiguration Properties|Linker|Systemh, then Click cell gSubSystemh

Figure 19
A button will appear at the right end of the cell (Figure 20).

Figure 20
Click the button, then a list of values will be presented (Figure 21).

Figure 21
Select gWindows (/SUBSYSTEM:WINDOWS)h, then push Apply button (Figure 22).

Figure 22
Next, Select gLinker|Advancedh, then property gEntry Pointh will be shown (Figure 23).

Figure 23
As gEntry Pointh value, enter the same name gmainh as in the source code file, then push Apply button (Figure 24).

Figure 24
Click OK button.
After the above setting of the two properties of the project, the console window will not appear when the program starts.
Yasuharu Okamoto