Creating a New Project
Congrats on installing Microsoft Visual Studio! Let’s get
started with the project creation step.
Video Guide :
So, after you installed and configured Visual Studio, you
can go to File->New->Project.
From there choose Visual C++. And CLR.
Next Choose CLR Empty Project and give it a name and
Click OK to create the Project.
Now Visual Studio will create an Empty Project for you,
which you can later on add more elements and create a Unique Application!
Next go to Project->Add New Item.
Now paste the following Code. Now you may start to panic
saying that you don’t want to copy and paste code. But the truth is this is
just template code which is supposed to be added by Visual Studio. But
unfortunately, Visual Studio doesn’t have the template from Visual Studio 2012
and onwards. Therefore, we need to create on our own. So, don’t panic. Follow
me and I’ll explain everything when needed.
#include "MyForm.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThreadAttribute]
void main(array<String^>^args) {
Application::SetCompatibleTextRenderingDefault(false);
Application::EnableVisualStyles();
MyFirstGUI::MyForm form;
Application::Run(%form);
}
Now click OK.
Congratulations on creating your First GUI App in C++.
Stay tuned, we will meet with the next tutorial. In the next
tutorial, we will discuss how you can add text to the Application!
Also stay tuned for a detailed explanation on the things we
did today!
No comments:
Post a Comment