You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/step-1-create-a-project-and-add-a-table-to-your-form.md
+35-14Lines changed: 35 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "Step 1: Create a project and add a table to your form"
3
-
ms.date: 11/04/2016
3
+
ms.date: 05/31/2019
4
4
ms.topic: conceptual
5
5
ms.prod: visual-studio-windows
6
6
ms.technology: vs-ide-general
@@ -21,33 +21,55 @@ The first step in creating a matching game is to create the project and add a ta
21
21
22
22
1. On the menu bar, choose **File** > **New** > **Project**.
23
23
24
+
1. Choose either **Visual C#** or **Visual Basic** on the left side of the **New Project** dialog box, and then choose **Windows Desktop**.
25
+
26
+
1. In the list of templates, choose the **Windows Forms App (.NET Framework)** template, name it *MatchingGame*, and then choose the **OK** button.
27
+
28
+
A form that's named *Form1.cs* or *Form1.vb* appears, depending on the programming language that you chose.
29
+
30
+
> [!NOTE]
31
+
> If you don't see the **Windows Forms App (.NET Framework)** template, use the Visual Studio Installer to install the **.NET desktop development** workload.<br/><br/><br/><br/> For more information, see the [Install Visual Studio](../install/install-visual-studio.md) page.
32
+
24
33
::: moniker-end
25
34
26
35
::: moniker range="vs-2019"
27
36
28
37
1. On the start window, choose **Create a new project**.
29
38
30
-
1. In the search box, type "WPF", choose **WPF App (.NET Framework)**, and then choose **Next**.
39
+

31
40
32
-
(If you don't see the **WPF App (.NET Framework)**template, use the Visual Studio Installer to install the **.NET desktop development** workload.)
41
+
1. On the **Create a new project**window, enter or type *Windows Forms* in the search box.
33
42
34
-
1.Give the project a name, **MatchingGame**, and choose **Create**
43
+
1.Choose the **Windows Forms App (.NET Framework)** template, and then choose **Next**.
35
44
36
-
::: moniker-end
45
+

46
+
47
+
> [!NOTE]
48
+
> If you do not see the **Windows Forms App (.NET Framework)** template, you can install it from the **Create a new project** window. In the **Not finding what you're looking for?** message, choose the **Install more tools and features** link.
49
+
>
50
+
> 
51
+
>
52
+
> Next, in the Visual Studio Installer, choose the Choose the **.NET desktop development** workload.
53
+
>
54
+
> 
55
+
>
56
+
> After that, choose the **Modify** button in the Visual Studio Installer. You might be prompted to save your work; if so, do so. Next, choose **Continue** to install the workload.
57
+
58
+
1. In the **Configure your new project** window, type or enter *MatchingGame* in the **Project name** box. Then, choose **Create**.
37
59
38
-
2. If you're not using Visual Studio Express, you need to select a programming language first. From the **Installed Templates** list, choose either **Visual C#** or **Visual Basic**.
60
+
::: moniker-end
39
61
40
-
3. In the list of project templates, choose **Windows Forms Application**, name the project **MatchingGame**, and then choose the **OK** button.
62
+
## To set properties for a form
41
63
42
-
4. In the **Properties** window, set the following form properties.
64
+
1. In the **Properties** window, set the following form properties.
43
65
44
66
1. Change the form's **Text** property from **Form1** to **Matching Game**. This text appears at the top of the game window.
45
67
46
68
2. Set the size of the form to 550 pixels wide by 550 tall. You can do this either by setting the **Size** property to **550, 550**, or by dragging the corner of the form until you see the correct size in the lower-right corner of the integrated development environment (IDE).
47
69
48
-
5. Display the toolbox by choosing the **Toolbox** tab on the left side of the IDE.
70
+
2. Display the toolbox by choosing the **Toolbox** tab on the left side of the IDE.
49
71
50
-
6. Drag a <xref:System.Windows.Forms.TableLayoutPanel> control from the **Containers** category in the toolbox, and then set the following properties for it.
72
+
3. Drag a <xref:System.Windows.Forms.TableLayoutPanel> control from the **Containers** category in the toolbox, and then set the following properties for it.
51
73
52
74
1. Set the **BackColor** property to **CornflowerBlue**. To do this, open the **BackColor** dialog box by choosing the drop-down arrow next to the **BackColor** property in the **Properties** window. Then, choose the **Web** tab in the **BackColor** dialog box to view a list of available color names.
53
75
@@ -66,7 +88,7 @@ The first step in creating a matching game is to create the project and add a ta
66
88
67
89
Your TableLayoutPanel should now be a 4x4 grid, with sixteen equally sized square cells. These rows and columns are where the icon images will appear later.
68
90
69
-
7. Be certain that the TableLayoutPanel is selected in the form editor. To verify this, you should see **tableLayoutPanel1** at the top of the **Properties** window. If it is not selected, choose the TableLayoutPanel on the form, or choose it in the dropdown control at the top of the **Properties** window.
91
+
4. Be certain that the TableLayoutPanel is selected in the form editor. To verify this, you should see **tableLayoutPanel1** at the top of the **Properties** window. If it is not selected, choose the TableLayoutPanel on the form, or choose it in the dropdown control at the top of the **Properties** window.
70
92
71
93
While the TableLayoutPanel is selected, open the toolbox and add a <xref:System.Windows.Forms.Label> control (located in the **Common Controls** category) to the upper-left cell of the TableLayoutPanel. The label control should now be selected in the IDE. Set the following properties for it.
72
94
@@ -89,15 +111,14 @@ The first step in creating a matching game is to create the project and add a ta
89
111
> [!NOTE]
90
112
> The Webdings font is a font of icons that ships with the Windows operating system. In your matching game, the player needs to match pairs of icons, so you use this font to display the icons to match. Instead of putting **c** in the **Text** property, try entering different letters to see what icons are displayed. An exclamation point is a spider, an uppercase N is an eye, and a comma is a chili pepper.
91
113
92
-
8. Choose your Label control and copy it to the next cell in the TableLayoutPanel. (Choose the **Ctrl**+**C** keys, or on the menu bar, choose **Edit** > **Copy**.) Then paste it. (Choose the **Ctrl**+**V** keys, or on the menu bar, choose **Edit** > **Paste**.) A copy of the first Label appears in the second cell of the TableLayoutPanel. Paste it again, and another Label appears in the third cell. Keep pasting Label controls until all of the cells are filled.
114
+
5. Choose your Label control and copy it to the next cell in the TableLayoutPanel. (Choose the **Ctrl**+**C** keys, or on the menu bar, choose **Edit** > **Copy**.) Then paste it. (Choose the **Ctrl**+**V** keys, or on the menu bar, choose **Edit** > **Paste**.) A copy of the first Label appears in the second cell of the TableLayoutPanel. Paste it again, and another Label appears in the third cell. Keep pasting Label controls until all of the cells are filled.
93
115
94
116
> [!NOTE]
95
117
> If you paste too many times, the IDE adds a new row to the TableLayoutPanel so that it has a place to add your new Label control. You can undo it. To remove the new cell, choose the **Ctrl**+**Z** keys, or on the menu bar, choose **Edit** > **Undo**.
96
118
97
119
Now your form is laid out. It should look like the following picture.
98
120
99
-

100
-
Initial matching game form
121
+
<br/> Initial matching game form
Copy file name to clipboardExpand all lines: docs/ide/step-1-create-a-project-and-add-labels-to-your-form.md
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,14 @@ As the first steps in developing this quiz, you create the project, and you add
24
24
25
25
1. On the menu bar, choose **File** > **New** > **Project**.
26
26
27
-
1.In the**Installed Templates**list, choose either **C#**or **Visual Basic**.
27
+
1.Choose either**Visual C#**or **Visual Basic** on the left side of the **New Project**dialog box, and then choose **Windows Desktop**.
28
28
29
-
1. In the list of templates, choose the **Windows Forms Application** template, name it **MathQuiz**, and then choose the **OK** button.
29
+
1. In the list of templates, choose the **Windows Forms App (.NET Framework)** template, name it *MathQuiz*, and then choose the **OK** button.
30
30
31
-
A form that's named *Form1.cs* or *Form1.vb* appears, depending on the programming language that you chose.
31
+
A form that's named *Form1.cs* or *Form1.vb* appears, depending on the programming language that you chose.
32
+
33
+
> [!NOTE]
34
+
> If you don't see the **Windows Forms App (.NET Framework)** template, use the Visual Studio Installer to install the **.NET desktop development** workload.<br/><br/><br/><br/> For more information, see the [Install Visual Studio](../install/install-visual-studio.md) page.
32
35
33
36
::: moniker-end
34
37
@@ -59,7 +62,7 @@ As the first steps in developing this quiz, you create the project, and you add
59
62
60
63
::: moniker-end
61
64
62
-
## To create set properties for a form
65
+
## To set properties for a form
63
66
64
67
1. In Visual Studio, choose the form (either *Form1.cs* or *Form1.vb*, depending on the programming language), and then change its **Text** property to **Math Quiz**.
2. Choose either **Visual C#** or **Visual Basic** on the left side of the **New Project** dialog box.
29
+
2. Choose either **Visual C#** or **Visual Basic** on the left side of the **New Project** dialog box, and then choose **Windows Desktop**.
31
30
32
-
3. In the templates list, choose **Windows Forms App (.NET Framework)**. Name the new form **PictureViewer**, and then choose the **OK** button.
31
+
3. In the templates list, choose **Windows Forms App (.NET Framework)**. Name the new form *PictureViewer*, and then choose the **OK** button.
33
32
34
33
>[!NOTE]
35
34
>If you don't see the **Windows Forms App (.NET Framework)** template, use the Visual Studio Installer to install the **.NET desktop development** workload.<br/><br/><br/><br/> For more information, see the [Install Visual Studio](../install/install-visual-studio.md) page.
@@ -44,7 +43,7 @@ When you create a picture viewer, the first step is to create a Windows Forms Ap
44
43
45
44

46
45
47
-
1. On the **Create a new project** window, enter or type *Windows Forms* in the search box. Next, choose **Visual Basic** from the Language list, and then choose **Windows** from the Platform list.
46
+
1. On the **Create a new project** window, enter or type *Windows Forms* in the search box. Next, choose **Visual Basic** from the Language list, and then choose **Windows** from the Platform list.
48
47
49
48
After you apply the language and platform filters, choose the **Windows Forms App (.NET Framework)** template, and then choose **Next**.
50
49
@@ -53,13 +52,13 @@ When you create a picture viewer, the first step is to create a Windows Forms Ap
53
52
> [!NOTE]
54
53
> If you do not see the **Windows Forms App (.NET Framework)** template, you can install it from the **Create a new project** window. In the **Not finding what you're looking for?** message, choose the **Install more tools and features** link.
55
54
>
56
-
> 
57
-
>
55
+
> 
56
+
>
58
57
> Next, in the Visual Studio Installer, choose the Choose the **.NET desktop development** workload.
59
-
>
58
+
>
60
59
> 
61
60
>
62
-
> After that, choose the **Modify** button in the Visual Studio Installer. You might be prompted to save your work; if so, do so. Next, choose **Continue** to install the workload.
61
+
> After that, choose the **Modify** button in the Visual Studio Installer. You might be prompted to save your work; if so, do so. Next, choose **Continue** to install the workload.
63
62
64
63
1. In the **Configure your new project** window, type or enter *PictureViewer* in the **Project name** box. Then, choose **Create**.
65
64
@@ -109,4 +108,4 @@ Visual Studio creates a solution for your program. A solution acts as a containe
109
108
110
109
## See also
111
110
112
-
-[Creating a new Windows Form](/dotnet/framework/winforms/creating-a-new-windows-form/)
111
+
-[Creating a new Windows Form](/dotnet/framework/winforms/creating-a-new-windows-form/)
0 commit comments