编写C#控制台附件 [英] writing a C# console apllications

查看:134
本文介绍了编写C#控制台附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi..i最近才加入代码,这是我的第一个问题,希望是最好的..am是一名使用c#在Windows应用程序项目上工作的软件工程师学生,所以我想知道如何制作24个数组应用程序中要使用的按钮,请创建一个名为mindboggle ....

hi..i have just joined the code recently and this is my first question hope for the best..am a software engineer student working on a windows application project using c# so i want to know how do make an array of 24 buttons to be used in the application,am creating a game called mindboggle....

推荐答案

好吧,如果您需要按钮,我建议不要制作控制台应用程序.您应该制作一个WinForms或WPF应用程序.

如果创建WPF应用程序,则可以设置ListView并绑定到对象集合,然后为每个对象创建一个呈现为按钮的模板.

可以执行以下操作:

在您的数据上下文对象中,包含一些具有命令的对象的集合.

Well if you want buttons I would recomend NOT making a console application. You should make a WinForms or a WPF application.

If you make a WPF application you can set up a ListView and bind to a collection of objects, and then for each object make a template that is rendered as a button.

This can be done as follows:

In your data context object have a collection of some object that has commands.

public interface IObjectThatFiresCommand
{
    ICommand SomeCommand {get;}
}

public class TheDataContext
{
     //Fill the collection on start up or something...
     public ObservableCollection<iobjectthatfirescommand> Collection {get; set;}
}

</iobjectthatfirescommand>




然后当然是XAML




and then of course the XAML

<listview itemssource="{Binding Path=Collection}">
   <listview.itemtemplate>
       <datatemplate>
           <Button Command={Binding Path=SomeCommand}/>
       
   </datatemplate></listview.itemtemplate>
</listview>


控制台应用程序不能替代Windows应用程序. System.Windows.Forms或WPF应用程序可以同时是控制台应用程序.项目属性输出类型"上带有值控制台应用程序"的Visual Studio选项仅表示使用控制台",而不是不使用Windows库".并且"Windows应用程序"选项并不意味着使用Windows API"(相当令人困惑),实际上意味着不显示控制台".

换句话说,实际上,您可以从WPF或System.Windows.Forms模板开始创建Windows应用程序. 输出类型"将设置为"Windows应用程序".创建项目后,将其更改为控制台应用程序"-您将拥有相同的内容以及一个控制台! (好吧,不要在生产软件中使用这种东西-看起来很丑.)

不要在文本模式按钮上浪费时间(如果这是您的意思).开发Forms或WPF应用程序也可能会浪费时间,但可能会浪费一些最少量的时间,您不会对此感到后悔.

—SA
A console application is not an alternative to a windows application. A System.Windows.Forms or WPF application can be a console application at the same time. A Visual Studio option on the project property "Output type" with the value "Console application" simply means "Use console", not "don''t use Windows libraries"; and the option "Windows Application" does not mean "use Windows API" (quite confusingly), it really means "don''t show console".

In other words, practically, you can start with creation of Windows application starting from WPF or System.Windows.Forms template. The "Output type" will be set to "Windows Application". After a project is created, change it to "Console Application" — you will have the same thing plus a console! (Well, don''t use such thing for production software — will look ugly.)

Don''t waste time on text-mode buttons (if this is what did you mean). Developing of a Forms or WPF application could also be a waste of time, but it could waste some minimum amount of time you would not be so sorry about.

—SA


这篇关于编写C#控制台附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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