我要如何转换一个.NET控制台应用程序以一个WinForms或WPF应用程序 [英] How do I convert a .NET console application to a Winforms or WPF application

查看:565
本文介绍了我要如何转换一个.NET控制台应用程序以一个WinForms或WPF应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常先从简单的控制台应用程序来尝试出了一个主意,然后创建一个新的基于GUI的项目,并复制code的影响。有没有更好的办法?我可以将我现有的控制台应用程序容易吗?

I frequently start with a simple console application to try out an idea, then create a new GUI based project and copy the code in. Is there a better way? Can I convert my existing console application easily?

推荐答案

只需添加一个新的WinForm的,添加以下code到主:

Just add a new Winform, add the following code to your Main:

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

然后右键单击您的项目,并选择属性,然后更改输出型到Windows应用程序,你就大功告成了。

Then right click your project and select properties and change the "Output type" to Windows application and you're done.

编辑:

在VS2008的属性更改为应用程序类型

In VS2008 the property to change is Application type

这篇关于我要如何转换一个.NET控制台应用程序以一个WinForms或WPF应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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