如何将控制台应用程序更改为Windows窗体应用程序?

编程入门 行业动态 更新时间:2024-10-28 18:27:43
本文介绍了如何将控制台应用程序更改为Windows窗体应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在开发一个控制台应用程序,直到我们的项目需要一个花哨的UI去与它,所以我们决定更改为Windows窗体应用程序的项目类型。我们尝试将代码放在我们的入口点:

I had been developing a console application, until our project needed a fancy UI to go with it, so we decided to change the project type to windows form application. We tried putting the code below in our entry point:

Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new UI());

这是一种工作,但原来的控制台窗口仍然存在。

It kind of works, but the original console window is still there.

我已经搜索了一些有用的信息,例如这一个,但他们做的是在它创建后基本上杀了窗口,而不是解决问题的根本。

I've googled out some useful infos like this one, but what all they do is essentially killing the window after it has been created, not tackling the root of the problem. So is there any more elegant way to do this?

推荐答案

在解决方案资源管理器中右键单击项目并选择属性。 然后,在应用程序选项卡下,将项目的输出类型从控制台应用程序更改为Windows应用程序。

Right click your project in the solution explorer and select properties. Then, under the "Application" tab change the "Output type" of your project from "Console Application" to "Windows Application."

更多推荐

如何将控制台应用程序更改为Windows窗体应用程序?

本文发布于:2023-11-09 13:40:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572509.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   窗体   控制台   如何将   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!