你好!我是高级C++的初学者,因为我只做过低级C++和C以及应用程序脚本,如Unity和虚幻引擎。
我决定只用 C++ 创建我的游戏,其中可能有一点 C 代码。
我的问题是这个。有没有办法像在 C# 中一样只用代码使用 WinForms?
我已经在互联网上为这个问题找了很多小时,我不想出现问题。
在 C# 中,一个简单的 Windows 窗体是
using System.Windows.Forms;
namespace baseform
{
class Program
{
static void Main(string[] args)
{
Form baseform = new Form();
Button mybutton = new Button()
{
Text = "Quit",
Location = new System.Drawing.Point(10, 10)
};
mybutton.Click += (o, s) =>
{
MessageBox.Show("Quitting Application");
Application.Exit();
};
baseform.Controls.Add(mybutton);
baseform.ShowDialog();
while (baseform.Created)
{
}
}
}
}
我该怎么做是 C++?
Note:此问题总结整理于: is there any way to do C++ winforms with just code?