Background:

From Windows Forms Application in Visual C++ ???!!!!:

"MS removed the WinForms C++/CLI template starting in either VS2012 or VS2013.  The official explanation is that they want to encourage managed desktop UI development in C# or VB and relegate C++/CLI to serve as glue between native back end code and managed UI code."

But for some reason, there are still many people who have reason to create a Windows Forms project of type C++/CLI, for these people, the following steps will show you how to start a C++/CLI Windows Forms app in Visual Studio 2017.

Environmental configuration:

Modify your Visual Studio 2017 installer and make sure your Visual Studio 2017 have installed C++ package with C++/CLR:

Create new project:

1, If you have installed all the package and components, then open Visual Studio 2017 and create a new project:

2, You need to configure some properties first, right click on the Project and choose Properties option:

Add new item:

1, Right click on the project to add a new item, select UI under Visual C++,then choose Windows Form:

In general, you will get error as below in this step:

2, Don't worry, close it and add the following code to the MyForm.cpp:

using namespace System;
using namespace System::Windows::Forms;[STAThreadAttribute]
void Main(array<String^>^ args) {Application::EnableVisualStyles();Application::SetCompatibleTextRenderingDefault(false);Project1::MyForm form;Application::Run(%form);
}

3, After that, save it and close the Visual Studio, then reopen your Project. Note that when you reopen your Project, remember to build(or run directly) it first:

4, Now you can do your options in the form by double click MyForm.h:

转载于:https://www.cnblogs.com/jizhiqiliao/p/10071703.html

Create C++ Windows Forms Application in Visual Studio 2017相关推荐

  1. OpenGL 开发环境配置(Windows) - Visual Studio 2017 + GLFW + GLAD 详细图文教程

    OpenGL 开发环境配置(Windows) - Visual Studio 2017 + GLFW + GLAD 详细图文教程 大部分 OpenGL 是直接面向设备商的,如果开发者需要使用 Open ...

  2. Visual Studio 2017 - Windows应用程序打包成exe文件(1)- 工具简单总结

    最近有对一个Windows应用程序少许维护和修改.修改之后要发布新的exe安装文件,打包exe文件时,遇到了很头疼的问题,还好最后解决了,记录一下. Visual Studio版本:Visual St ...

  3. Visual Studio 2017 调试 windows server 2016 Docker Container

    网上很多文章都是在win10下,用Docker for windows工具进行Docker的安装部署的.用知道windows server 2016已经原生支持Docker了,其windows Con ...

  4. 微软公布测试版Visual Studio for Mac和Visual Studio 2017 for Windows

    本周早些时候泄露的文档显示:微软正在向开发者提供两个新测试版Visual Studio的服务:Visual Studio for Mac以及Visual Studio 2017 for Windows ...

  5. Windows 10 Visual Studio 2017 安装配置 Apache Thrift (C++)

    最近需要使用Thrift,所以在网上看了很多资料,不过很多教程都不够详细完整,导致我花了不少时间安装配置.在这里我把我配置的过程写下来和大家分享. 1 介绍 Apache Thrift 是一个跨语言的 ...

  6. MySQL安装时MySQL server一直安装失败日志显示This application requires Visual Studio 2013 Redistributable...

    使用MySQL社区版的msi包进行安装,试了好多次,别的组件都能正常安装,只有MySQL server的安装状态显示为fail.删除所有安装的程序,包括所依赖的各种Microsoft发布的包,删除所有 ...

  7. 微软建议Windows 10开发人员升级到Visual Studio 2017

    既然Visual Studio 2017已经发布,那就意味着微软开始专注于让其成为默认开发平台.Creators Update SDK的发布(面向即将到来的Windows 10 Creators Up ...

  8. Create an offline installation of Visual Studio 2017 RC

    Create an offline installation of Visual Studio 2017 RC ‎2016‎年‎12‎月‎7‎日                             ...

  9. windows 运行linux c++,Visual studio中使用C++的Linux 开发

    Visual studio中使用C++的Linux 开发 05/15/2017 14 分钟可看完 本文内容 [原文发表地址] Linux development with C++ in Visual ...

最新文章

  1. 有关YARN/MRv2 相关
  2. 5G+AI,自动驾驶进入“中国时间”
  3. vivado与modelsim的联合仿真(一)
  4. Mac OS X下使用C++ JSON库
  5. stringBuffer、StringBuilder、排序、Arrays、Jdk1.5新特性(java基础知识十三)
  6. jQuery源码解析(2)—— Callback、Deferred异步编程
  7. CPU版本文本分类代码 寒老师
  8. 怎样开图纸便宜_一步一步教你如何看懂工程图纸,值得收藏!
  9. linux用户名不在sudoers,如何修复“用户名不在sudoers文件中。这个事件将报告“在Ubuntu...
  10. webstorm 搜狗输入法,输入汉字变成繁体字
  11. linux 怎么关闭输入法快捷键设置方法,关闭输入法快捷键
  12. conda安装本地whl文件
  13. C2872 “detail”: 不明确的符号
  14. 【IT视频】支付宝架构师眼中的高并发架构
  15. Flink大数据计算框架
  16. 【渝粤教育】国家开放大学2018年秋季 0088-21T保险学概论 参考试题
  17. 图像修复(Image Restoration)
  18. xftp无法连接到虚拟机
  19. 数字经济的发展需要包括区块链在内的八大技术的支撑360云储
  20. 一文简述服务器架构的演变过程:集群—分布式—微服务

热门文章

  1. 传海思砍台积电第三季度一半手机订单
  2. Windows Server2003 sp2重装IIS后无法浏览asp.net网页解决方法
  3. 配置静态路由使用出站接口和下一跳IP的差别
  4. 看完这些细分领域别说小程序代理创业没有机会
  5. P3201 [HNOI2009]梦幻布丁 [启发式合并][set]
  6. Jetty 基本使用样例
  7. Alpha 冲刺 (5/10)
  8. SQL Server 2008还原数据库时出现“备份集中的数据库备份与现有的数据库不同”的解决方法...
  9. (二)企业部分之lnmp环境的搭建:mysql源码安装
  10. 科普:浅谈 Hellinger Distance