如何使用 C++/CLI 编写 Winforms 应用程序
是否有 pdf 或视频或某些媒体可以告诉我如何使用 C++ 编写 Winforms 程序。显然 C++ 是最常见的编程语言,我已经有了一些先验知识。但当我尝试查找有关 C++ 编程的媒体时,示例通常是控制台应用程序。我想要一些媒体可以教我如何用 C++ 编写 Winforms 程序。
Is there a pdf or video or some media that can inform me on how to program Winforms with C++. Obviously C++ is the most common programming language and I already have some prior knowledge. But when I try to find media about programming in C++, the examples are usually Console applications. I want some media that can teach me how to program Winforms in C++.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
以下教程展示了如何用 C++/CLI 编写 Windows 窗体应用程序。
请注意,大多数示例往往采用 C# 语言。许多人故意使用 C# 作为表单,使用 C++ 作为逻辑,并使用 C++/CLI 将其逻辑公开为 .NET 程序集(以便 C#/VB.NET 轻松使用)。这很有帮助,因为 Windows 窗体的 C# 或 VB.NET 的设计时体验要好得多。
Here's a tutorial showing how to write Windows Forms applications in C++/CLI.
Just be aware that most samples tend to be in C#. Many people purposely use C# for the forms, C++ for their logic, and use C++/CLI to expose their logic as .NET assemblies (For easy use by C#/VB.NET). This helps, since the design-time experience is much nicer in C# or VB.NET for Windows Forms.
坏主意,恕我直言。托管 C++ 很丑陋;它从来就不是一种垃圾收集语言。它的力量在别处。我推荐 C# - 类似的语法,高度市场化的技能。
先发制人的尖酸刻薄的评论:所有的 C++ 都是丑陋的。
Bad idea, IMHO. Managed C++ is ugly; it was never meant to be a garbage-collected language. Its strength lies elsewhere. I recommend C# instead - similar syntax, highly marketable skill.
Preemtive snarky comment: all C++ is ugly.
您是否查看过 MSDN 文章?我并不是说我推荐这样做,但他们至少提供了一个开始。
至于 Seva Alekseyev 的评论,即所有 C++ 都是丑陋的:这就像关于民主是除所有其他形式之外最糟糕的政府形式的旧评论一样。他说所有的 C++ 都很丑陋,这是对的,但没有提到所有的替代方案都更糟糕。
Have you looked at the MSDN articles? I'm not saying I recommend this, but they do at least give a start.
As far as Seva Alekseyev's comment that all C++ is ugly: it's like the old comment about democracy being the worst form of government except for all the others. He's right that all C++ is ugly, but fails to mention that all the alternatives are even worse.
只需创建一个新的 C++ .NET 项目并开始进行 C++ 编程。适用于 .NET 的附加语法是托管指针和 .NET 类。您可以在 MSDN 中找到有关它们的信息,包括许多有用的示例。
Just create a new C++ .NET project and start programming your C++. And additional syntax applies to .NET is managed pointers and .NET classes. Information about them you can find in MSDN, including lots of useful examples.
嗯,关于这个话题各地都有不同的观点。我的座右铭是始终使用正确尺寸的锤子来完成工作——而且,一般来说,C++ 对于制作 winform 来说是错误尺寸的锤子。我喜欢 C++,但只有在绝对需要运算速度时才使用它。
C#(或 VB.Net,如果你必须的话)对 UI 创建的支持比 C++ 好得多,尽管我注意到 Visual Studio 2010 提供了一些急需的增强功能,使在 .NET 4.0 中开发 Winform 变得更加容易。如果您必须坚持使用 C++,请考虑获取 Visual Studio 2010 的 Beta 版本。否则,请使用 C# 作为您的 UI、数据访问、文件操作、通用语言和 C++(如果您必须编写自定义物理引擎来配合它) 。
Well, there are opinions all over the place on this topic. My motto is always to use the right size hammer for the job-- and, in general, C++ is the wrong size hammer for making winforms. I love C++, but I only use it when there is an absolute necessity for speed of operations.
C# (or VB.Net, if you must) has MUCH better support for UI creation than C++, though I have noticed that Visual Studio 2010 offers some much needed enhancements to make developing Winforms easier in .NET 4.0. If you MUST stick with C++, look into obtaining a beta version of Visual Studio 2010. Otherwise, use C# as your UI, data access, file manipulation, general purpose language and C++ if you have to write a custom physics engine to go with it.