如何将控制台应用程序更改为Windows窗体应用程序? [英] How to change a console application to a windows form application?

查看:1190
本文介绍了如何将控制台应用程序更改为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窗体应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆