C++/CLR using (vs2012,vs2013,vs2015) writing

Source: Internet
Author: User

Reprinted from: http://www.th7.cn/system/win/201509/129417.shtml

VS2010 and previous versions, when you create a project, you can find the project template for Windows Forms applications under the CLR, but VS2012 later versions are less convenient. You can modify the old version of the project by opening it, or you can do the following:

here, take VS2015 as an example, open VS2015 as shown:

As we all know, WinForm needs. NET support. So we need to create a CLR empty project with the following steps:

① New Project

② Select CLR Empty Project

③ Results

Add WinForm Header file:

① Right-click on the header file to add New item

② Select UI for Windows Forms

③ Results

Note that the results here in the third step may be ( please note!) It was possible, anyway on my computer. error: to avoid possible data loss before loading the designer, you must correct the following error .

Here you can ignore, follow the steps to continue walking ...
There is a well-known form designer here, but it is still not allowed because there is no main function. You need to continue with the following actions:

① writing the main function code


The code here gives you attention to modifying the corresponding namespace name and the form class name.

When you get here, save the changes, turn off the error window, and then reopen it, and you'll see that it's the following:

Everything's OK! Celebrate

② click on "Local Windows debugging", results:


Then:

We found that the program could be compiled and run successfully, but there was still a dark console left. Next, we'll remove the console by setting it up:

① Right click on Project, set project properties

② subsystem changed to window

The ③ entry function is set to main

④ again, the black box is gone.

C++/CLR using (vs2012,vs2013,vs2015) writing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.