Windows窗体和对象方向 [英] Windows Forms and Object Orientation

查看:48
本文介绍了Windows窗体和对象方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.我对面向对象编程很感兴趣.我过去一直在使用Java.我曾经制作过完全面向对象的控制台应用程序.现在,我正在使用C#创建Windows窗体应用程序.但是我发现很难进行干净的面向对象编程.一切似乎都已正确编码到表格中.据我所知,这不是一个好习惯.

有人告诉我在Windows窗体上使用用户控制"来编写干净且更灵活的代码,但即使在MSDN上,关于此的内容似乎也很少.

关于如何设计符合C#中面向对象编程原理的用户界面的有用链接吗?

在此先谢谢您.

Hi. I am a big fun of object oriented programming. I have been using Java in the past. And I used to make fully object oriented console applications. Now, I am using C# to create Windows Forms application. But I''m finding it hard to make a clean object oriented programming. Everything seems to be coded right into the form. And this is not a good practice, as I know.

Some one told me to use User Control along Windows forms to make a clean and more flexible coding but it seems there are few things written about this even on MSDN.

Any useful link on how to design user interface that adheres to object oriented programming principles in C#?

Thanks in advance.

推荐答案

根据定义,C#始终为OO.但是,与Java中的代码相同,由您决定编写好的代码.如果将所有代码都放在表单中,那么它不是很面向对象.如果创建业务逻辑类,则可以以更有序的方式进行分解.除非需要自定义控件,否则无需创建用户控件,也无需将多个控件组合到一个控件中以进行重用.
C# is, by definition, always OO. But, it''s up to you to write good code, same as it was in Java. If you put all your code inside your form, then it''s not very OO. If you create business logic classes, then you can factor things out in a more orderly fashion. There''s no need to create user controls unless you need a custom control, or to group several controls together into a single control for reuse.


这篇关于Windows窗体和对象方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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