在C#中派生类的可视化 [英] Visualisation of derived classes in C#

查看:166
本文介绍了在C#中派生类的可视化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基类(代表充满了小球一个真实的世界集装箱)和一些派生类。这工作就好了。结果
我的问题是如何做好自己的可视化。我有一个用户控件可视化的基类。是让每一个派生类派生用户控件的最佳解决方案?或者是它更好地只有一个工作了所有这些结果
编辑:结果
显然我是不够具体。总是有相同的基本外观:很多圈里的矩形。类之间的差是在容器的填充方式。一类把种子在中间,并创建其他领域的树状结构 - 在这种情况下,父母与子女之间的连接线应绘制结果
一般来说应该有阶级一致的外观。可视化与每个派生类的几个特色菜。

I have a base class (representing a real world container filled with small spheres) and some derived classes. This works just fine.
My problem is how to do their visualisation. I have a UserControl visualising the base class. Is the best solution to have a derived UserControl for each of the derived classes? Or is it better to have just one working for all of them?

Apparently I was not specific enough. There is always the same basic appearance: rectangle with a lot of circles inside. The difference between the classes is how the container is filled. One type puts a seed in the middle and creates other spheres in a tree like structure - in this case the connecting lines between parents and their children should be drawn.
Generally there should be consistent look of the classes' visualisations with a few specialities for each derived type.

推荐答案

这真的取决于显示器将如何类似的是一个伟大的交易。如果派生类的显示器非常相似的基类,那么你只需要一个用户控件做visiualization。 OTOH,如果每个派生类需要显示独特的东西,那么你会好起来的有一个单独的用户控件可视化每个派生类。
我真的不能没有你的类更具体的信息任何更具体

This really depends a great deal on how similar the displays will be. If the displays of the derived classes are very similar to the base class then you only need the one UserControl to do the visiualization. OTOH, if each derived class needs to display unique things then you will be better off having a separate UserControl to visualize each derived class. I really can't be any more specific without more specific info on your classes.

编辑:
从其他信息我会说,你应该有绘制矩形黎民然后容器得出了该用户控件拉丝处理每种特定类型的内容的基础显示类。

From your additional info I would say that you should have a base display class that draws the commom rectangular container then have derived UserControls that handle drawing the contents of each specific type.

这篇关于在C#中派生类的可视化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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