I installed Visual Studio 2015, and tried to create a windows form, just as I used to do it in the VS2010. I could not find a Windows form for C#.
How can I create one? Do I need to install another version or do I need a plugin or something?
Screenshot: http://prntscr.com/8rwzyl
Informations about my Visual Studio: http://prntscr.com/8rx0a1
Dayan
7,41811 gold badges46 silver badges76 bronze badges
asked Oct 16, 2015 at 12:16
10
It seems you are opening new project in Blend
. You have to use Visual Studio
(not Blend).
Blend
and Visual Studio
are installed together with Visual Studio Community Edition 2015
. You probably run a wrong shortcut (which starts Blend
).
answered Oct 16, 2015 at 12:21
SinatrSinatr
20.4k14 gold badges91 silver badges303 bronze badges
4
The Checked Answer is correct however there is no explanation of how to solve this. I just came to the same problem, but figured it out. When searching in your file directory C:Program Files (x86)Microsoft Visual Studio2017CommunityCommon7IDE
Then you can search .exe and it will come up with Blend and devenv. Or just scroll till you find devenv. devenv is the clickable application for visual studio community.
answered Aug 21, 2017 at 0:08
- Remove From My Forums
-
Question
-
I need some help. I am taking a class on programming and need to use Visual Studio. I downloaded and successfully installed the 2015 version from the website here. However the assignment requires the Windows Form Application. Okay, I used
the steps below but the option is simply not there. How do I get this option in my C++ menu?To create a new Windows Forms project
-
On the File menu, click New, and then click Project….
-
In the Project Types pane, select CLR in the Visual C++ node, and then select Windows
Forms Application in the Templates pane.
-
Edited by
Wednesday, September 23, 2015 5:47 PM
clarification in title
-
Answers
-
I went through the menu and got it — New Project, Visual C++, CLR, CLR Empty Project.
Then Project, Add new item. Under UI, Windows Form. Now you have a form to work with.
It causes an error but if you close the form designer and then re-open it (edit — use Dave’s suggestion instead, just right-click and choose open designer),
you’ll see a form, in C++ language, finally….!-
Marked as answer by
Mermaiden
Thursday, September 24, 2015 2:13 AM -
Edited by
Mermaiden
Friday, September 25, 2015 3:07 AM
-
Marked as answer by
Как известно Visual C++ не входит в комплект поставки Visual Studio 2015. Поэтому работа с этим языком, включая Windows Forms, в «базовой» версии невозможна.
Однако, это, к счастью, легко исправить.
Поддержка Visual C++
Решение данной проблемы предлагает сама Microsoft. Если Вам необходим Visual C++, Вы можете загрузить и установить соответствующее дополнение. Причём загрузка и установка доступна непосредственно из интерфейса Visual Studio.
Для этого в окне создания нового проекта выберите «Установка инструментов Visual C++ 2015 для Desktop».
В появившемся окне нажмите кнопку «Установить».
После этого следуйте инструкциям программы установки.
Если у Вас нет необходимого инсталляционного пакета, программа предложит Вам скачать его через интернет и, в случае Вашего согласия, выполнит загрузку.
По завершении установки можно будет работать с Visual C++ 2015 также как и с другими установленными языками программирования.
Поддержка Windows Forms
В Visual Studio 2015 непосредственное создание проектов Windows Forms по-прежнему не поддерживается. Однако его поддержку вполне возможно реализовать и самостоятельно.
Реализация осуществляется полностью аналогично версиям Visual Studio 2012 и 2013.
Вначале вручную создаётся проект приложения с использованием Windows Forms . Затем этот проект сохраняется в качестве шаблона Visual Studio.
Процесс создания такого проекта и его сохранение в виде шаблона были подробно описаны ранее в статьях «Windows Forms в C++ для Visual Studio 2012, 2013» и «Шаблон проекта Windows Forms в C++ для Visual Studio 2012, 2013».
В результате, если всё выполнено правильно, у Вас снова появится возможность создавать проекты Windows Forms напрямую из окна создания нового проекта Visual Studio.
title | description | ms.custom | ms.date | ms.topic | ms.devlang | author | ms.author | manager | ms.technology | dev_langs | ms.workload |
---|---|---|---|---|---|---|---|---|---|---|---|
Create a Windows Forms app with C# |
Learn how to create a Windows Forms app in Visual Studio with C#, step-by-step. |
vs-acquisition, get-started |
1/24/2023 |
tutorial |
CSharp |
anandmeg |
meghaanand |
jmartens |
vs-ide-general |
CSharp |
multiple |
Create a Windows Forms app in Visual Studio with C#
[!INCLUDE Visual Studio]
In this tutorial, you’ll create a simple C# application that has a Windows-based user interface (UI).
::: moniker range=»vs-2019″
If you haven’t already installed Visual Studio, go to the Visual Studio downloads page to install it for free.
[!NOTE]
Some of the screenshots in this tutorial use the dark theme. If you aren’t using the dark theme but would like to, see the Personalize the Visual Studio IDE and Editor page to learn how.
::: moniker-end
::: moniker range=»vs-2022″
If you haven’t already installed Visual Studio, go to the Visual Studio 2022 downloads page to install it for free.
::: moniker-end
Create a project
First, you’ll create a C# application project. The project type comes with all the template files you’ll need, before you’ve even added anything.
::: moniker range=»vs-2019″
-
Open Visual Studio.
-
On the start window, choose Create a new project.
-
On the Create a new project window, choose the Windows Forms App (.NET Framework) template for C#.
(If you prefer, you can refine your search to quickly get to the template you want. For example, enter or type Windows Forms App in the search box. Next, choose C# from the Language list, and then choose Windows from the Platform list.)
[!NOTE]
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.Next, in the Visual Studio Installer, choose the .NET desktop development workload.
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. Then, return to step 2 in this «Create a project» procedure.
-
In the Configure your new project window, type or enter HelloWorld in the Project name box. Then, choose Create.
Visual Studio opens your new project.
::: moniker-end
::: moniker range=»>=vs-2022″
-
Open Visual Studio.
-
On the start window, select Create a new project.
:::image type=»content» source=»media/vs-2022/create-new-project-dark-theme.png» alt-text=»Screenshot to show the Create a new project window.»:::
-
On the Create a new project window, select the Windows Forms App (.NET Framework) template for C#.
(If you prefer, you can refine your search to quickly get to the template you want. For example, enter or type Windows Forms App in the search box. Next, select C# from the Language list, and then select Windows from the Platform list.)
:::image type=»content» source=»media/vs-2022/csharp-winform-create-a-new-project.png» alt-text=»Screenshot to select the C# template for the Windows Forms App (.NET Framework).»:::
[!NOTE]
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, select the Install more tools and features link.:::image type=»content» source=»../get-started/media/vs-2019/not-finding-what-looking-for.png» alt-text=»Screenshot to show the The ‘Install more tools and features’ link from the ‘Not finding what you’re looking for’ message in the ‘Create a new project’ window.»:::
Next, in the Visual Studio Installer, select the .NET desktop development workload.
:::image type=»content» source=»media/vs-2022/install-dot-net-desktop-env.png» alt-text=»Screenshot to show the .NET Core workload in the Visual Studio Installer.»:::
After that, select the Modify button in the Visual Studio Installer. You might be prompted to save your work; if so, do so. Next, select Continue to install the workload. Then, return to step 2 in this «Create a project» procedure.
-
In the Configure your new project window, type or enter HelloWorld in the Project name box. Then, select Create.
:::image type=»content» source=»media/vs-2022/csharp-winform-configure-new-project.png» alt-text=»Screenshot to show the ‘Configure your new project’ window and name your project ‘HelloWorld’.»:::
Visual Studio opens your new project.
Create the application
After you select your C# project template and name your file, Visual Studio opens a form for you. A form is a Windows user interface. We’ll create a «Hello World» application by adding controls to the form, and then we’ll run the app.
Add a button to the form
-
Select Toolbox to open the Toolbox fly-out window.
:::image type=»content» source=»media/vs-2022/csharp-winform-hello-world-project-toolbox.png» alt-text=»Screenshot to select the Toolbox to open the Toolbox window.»:::
(If you don’t see the Toolbox fly-out option, you can open it from the menu bar. To do so, View > Toolbox. Or, press Ctrl+Alt+X.)
-
Expand Common Controls and select the Pin icon to dock the Toolbox window.
:::image type=»content» source=»media/vs-2022/csharp-winform-toolbox-flyout-pin.png» alt-text=»Screenshot to select the Pin icon to pin the Toolbox window to the IDE.»:::
-
Select the Button control and then drag it onto the form.
:::image type=»content» source=»media/vs-2022/csharp-winform-add-button-on-form.png» alt-text=»Screenshot to add a button to the form.»:::
-
In the Properties window, locate Text, change the name from button1 to
Click this
, and then press Enter.:::image type=»content» source=»media/vs-2022/csharp-winform-button-properties-text.png» alt-text=»Screenshot to add text to the button on the form by using the Properties window.»:::
(If you don’t see the Properties window, you can open it from the menu bar. To do so, select View > Properties Window. Or, press F4.)
-
In the Design section of the Properties window, change the name from button1 to
btnClickThis
, and then press Enter.:::image type=»content» source=»media/vs-2022/csharp-winform-button-properties-design-name.png» alt-text=»Screenshot to add a function to the button on the form by using the Properties window.»:::
[!NOTE]
If you’ve alphabetized the list in the Properties window, button1 appears in the (DataBindings) section, instead.
Add a label to the form
Now that we’ve added a button control to create an action, let’s add a label control to send text to.
-
Select the Label control from the Toolbox window, and then drag it onto the form and drop it beneath the Click this button.
-
In either the Design section or the (DataBindings) section of the Properties window, change the name of label1 to
lblHelloWorld
, and then press Enter.
Add code to the form
-
In the Form1.cs [Design] window, double-click the Click this button to open the Form1.cs window.
(Alternatively, you can expand Form1.cs in Solution Explorer, and then choose Form1.)
-
In the Form1.cs window, after the private void line, type or enter
lblHelloWorld.Text = "Hello World!";
as shown in the following screenshot::::image type=»content» source=»media/vs-2022/csharp-winform-button-click-code.png» alt-text=»Screenshot to add code to the form»:::
Run the application
-
Select the Start button to run the application.
:::image type=»content» source=»media/vs-2022/csharp-winform-visual-studio-start-run-program.png» alt-text=»Screenshot to select Start to debug and run the app.»:::
Several things will happen. In the Visual Studio IDE, the Diagnostics Tools window will open, and an Output window will open, too. But outside of the IDE, a Form1 dialog box appears. It will include your Click this button and text that says label1.
-
Select the Click this button in the Form1 dialog box. Notice that the label1 text changes to Hello World!.
:::image type=»content» source=»media/vs-2022/csharp-winform-form.png» alt-text=»Screenshot to show a Form1 dialog box that includes label1 text.»:::
-
Close the Form1 dialog box to stop running the app.
::: moniker-end
::: moniker range=»<=vs-2019″
Create the application
After you select your C# project template and name your file, Visual Studio opens a form for you. A form is a Windows user interface. We’ll create a «Hello World» application by adding controls to the form, and then we’ll run the app.
Add a button to the form
-
Choose Toolbox to open the Toolbox fly-out window.
(If you don’t see the Toolbox fly-out option, you can open it from the menu bar. To do so, View > Toolbox. Or, press Ctrl+Alt+X.)
-
Choose the Pin icon to dock the Toolbox window.
-
Choose the Button control and then drag it onto the form.
-
In the Properties window, locate Text, change the name from Button1 to
Click this
, and then press Enter.(If you don’t see the Properties window, you can open it from the menu bar. To do so, choose View > Properties Window. Or, press F4.)
-
In the Design section of the Properties window, change the name from Button1 to
btnClickThis
, and then press Enter.[!NOTE]
If you’ve alphabetized the list in the Properties window, Button1 appears in the (DataBindings) section, instead.
Add a label to the form
Now that we’ve added a button control to create an action, let’s add a label control to send text to.
-
Select the Label control from the Toolbox window, and then drag it onto the form and drop it beneath the Click this button.
-
In either the Design section or the (DataBindings) section of the Properties window, change the name of Label1 to
lblHelloWorld
, and then press Enter.
Add code to the form
-
In the Form1.cs [Design] window, double-click the Click this button to open the Form1.cs window.
(Alternatively, you can expand Form1.cs in Solution Explorer, and then choose View Code(or press F7) from the right-click menu on Form1.cs.)
-
In the Form1.cs window, after the private void line, type or enter
lblHelloWorld.Text = "Hello World!";
as shown in the following screenshot:
Run the application
-
Choose the Start button to run the application.
Several things will happen. In the Visual Studio IDE, the Diagnostics Tools window will open, and an Output window will open, too. But outside of the IDE, a Form1 dialog box appears. It will include your Click this button and text that says Label1.
-
Choose the Click this button in the Form1 dialog box. Notice that the Label1 text changes to Hello World!.
-
Close the Form1 dialog box to stop running the app.
::: moniker-end
Next steps
Congratulations on completing this tutorial. To learn more, continue with the following tutorial:
[!div class=»nextstepaction»]
Tutorial: Create a picture viewer
See also
- More C# tutorials
- Visual Basic tutorials
- C++ tutorials
При создании нового проекта в Visual Studio для языка программирования C++ в мастере нет пункта Windows Forms. Но, безусловно, язык C++ поддерживает .NET и, соответственно, Windows Forms. Из этой статьи Вы узнаете, как создать в Visual Studio проект Windows Form на C++.
Сначала необходимо создать новый проект в Visual Studio.
Создание нового проекта C++ в Visual Studio
Запустите Visual Studio. Нажмите «Файл» → «Создать» → «Проект…». Или нажмите сочетание клавиш Ctrl + Shift + N на клавиатуре.
В появившемся окне «Создать проект» слева выберите группу «Visual C++», а в ней пункт «CLR». Щелкните по «Пустой проект CLR», введите имя проекта и нажмите кнопку «OK».
Таким образом мы создали новый проект на языке программирования C++ в Visual Studio.
Добавление Windows Forms в проект C++
Теперь в созданный проект на C++ добавим форму Windows Forms.
Для этого щелкните в «Обозревателе решений» на названии проекта правой кнопкой мыши, выберите пункт «Добавить» и затем «Создать элемент…». Либо просто нажмите на клавиатуре сочетание клавиш Ctrl + Shift + A.
Загрузится окно «Добавление нового элемента». В нём щёлкните левой кнопкой мыши по группе UI в выберите элемент «Форма Windows Forms — Visual C++». Можете изменить имя создаваемой формы. По завершении нажмите кнопку «Добавить».
Далее откройте файл исходного кода «MyForm.cpp» (если вы изменяли название формы, то файл будет иметь другое имя). В него добавьте следующий текст:
using namespace System; using namespace System::Windows::Forms; [STAThread] void main(array<String^>^ arg) { Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); WinFormsTest::MyForm form; //WinFormsTest — имя вашего проекта Application::Run(%form); } |
Если Вы указали имя проекта отличное от WinFormsTest, то, соответственно, в коде укажите введённое Вами имя.
Сохраните изменения в файле.
Теперь необходимо произвести ряд настроек проекта в Visual Studio. Приступим.
Щёлкните по названию проекта в «Обозревателе решений» правой кнопкой мыши и затем нажмите кнопку «Свойства». Либо сразу нажмите сочетание клавиш Alt + Enter.
В «Странице свойств» проекта слева выберите группу «Компоновщик» → «Система». В раскрывающемся списке «Подсистема» укажите Windows и нажмите кнопку «Применить».
Далее в разделе «Дополнительно» группы «Компоновщик» в качестве «Точки входа» укажите функцию main (напишите словом). Щелкните кнопку «Применить», а затем «ОК».
На этом настройка и создание проекта Windows Forms на C++ завершены! Чтобы просмотреть результат — запустите проект на выполнение (клавиша F5).
Видеоурок создания проекта WinForms C++
Today I will tell you about how to use additional form into C# source code without using Form Design.
First, you need to open under Visual Studio 2015 a new project Windows Form Application.
This project will come with a windows form.
Press Ctr+Alt+X keys and will see the Toolbox with all Windows controls.
Add one button to your window form with double left click.
Use double left click to your button and will see the source code of your form.
The C# script will be Form1.cs and for your button will have this:
private void button1_Click(object sender, EventArgs e) { } |
If you want to open a new form with your button then you need to add source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
private void button2_Click(object sender, EventArgs e) { Form fInfo = new Form(); fInfo.Text = «Info and about !»; fInfo.Size = new Size(350, 200); fInfo.StartPosition = FormStartPosition.CenterScreen; Label myText = new Label(); myText.Location = new Point(15, 15); myText.Width = 300; myText.Height = 15; myText.Text = «This software is created by the website: free-tutorials.org!»; myText.Visible = true; fInfo.Controls.Add(myText); fInfo.ShowDialog(this); } |
This source code will make a new form named fInfo with this text: Info and about !.
Into this form will have a label named myText with this text: This software is created by the website: free-tutorials.org!.
The form fInfo add the label myText and finally show this form.
The source code comes with size, height, weight, and location to show the form and label to design form.
The StartPosition is used to put the form into the center of your screen.
0 / 0 / 0 Регистрация: 24.11.2013 Сообщений: 32 |
|
1 |
|
15.08.2015, 00:15. Показов 37546. Ответов 7
Уважаемый программисты, помогите, пожалуйста, новичку. Не могу никак создать форму в Visual Studio 2015 C++. На c# — разобрался, создаешь проект windows Forms и дело в шляпе. А как быть с с++? Поискал методом тыка — не нашел, искал в инэте- везде написано так, будто пишут для опытного проггера, который слегка подзабыл и хочет вспомнить, но никак не для новичка. Создал различные проекты и win32 и пустой, нигде нет форм.. даже в добавлении элемента нет windows Forms… Куда нажать? какой проект создать? помогите пожалуйста, для Вас, уверен, все очевидно..
__________________
0 |
0 / 0 / 0 Регистрация: 24.11.2013 Сообщений: 32 |
|
17.08.2015, 19:40 [ТС] |
3 |
Прошу прощения.. Добавлено через 22 часа 15 минут
0 |
Администратор 9355 / 4637 / 755 Регистрация: 17.04.2012 Сообщений: 9,490 Записей в блоге: 14 |
|
17.08.2015, 20:47 |
4 |
Aivengo, тема по ссылке вам не помогла? Или появились какие-то проблемы, характерные для 2015 студии?
0 |
55 / 22 / 1 Регистрация: 11.03.2015 Сообщений: 41 |
|
18.08.2015, 12:07 |
5 |
К слову о инструкции в закрепленной теме:
0 |
Администратор 9355 / 4637 / 755 Регистрация: 17.04.2012 Сообщений: 9,490 Записей в блоге: 14 |
|
18.08.2015, 14:38 |
6 |
Galy4a, если имеется в виду вручную через редактирование resx-файла текстовым редактором, то неудивительно.
0 |
Galy4a 55 / 22 / 1 Регистрация: 11.03.2015 Сообщений: 41 |
||||
18.08.2015, 15:29 |
7 |
|||
Я имел ввиду добавление ресурсов средствами студии. Для решения проблемы достаточно после создания проекта, описанного в закрепленке, создать копию файла MyForm.resx, переименовать его в Resources.resx и подключить его к проекту через Проект->Добавить существующий элемент. Ну а дальше что-нибудь вроде этого:
, где Image1 — изображение, добавленное в новый файл ресурсов. Добавлено через 28 минут
2 |
0 / 0 / 0 Регистрация: 20.03.2016 Сообщений: 2 |
|
20.03.2016, 13:17 |
8 |
В панели меню есть меню Сервис—>Расширения и обновления, ищите в сети Windows Forms, устанавливаете, и можете сразу создавать проекты Windows Forms/
0 |