如何将控制图像列表作为参数传递给其他图层? [英] How to pass a control imagelist as parameter to other layers?

查看:72
本文介绍了如何将控制图像列表作为参数传递给其他图层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下午好.

我有一个在应用程序Windows窗体中没想到的问题.我要在3层中创建一个项目,在其中我需要将表示层的ImageList控件发送到业务层,然后访问数据,但是问题在于后两层是类库类型.但是我无法在业务和数据访问层中创建像这样的方法:

Good afternoon.

I have a problem I did not expect in an application windows forms. I''m creating a project in 3 layers, in which I need to send the ImageList control of my presentation layer to the business layer and then to access the data, but the problem is that the latter two layers are of type Class Library. But I can''t create mthods like these in the business and data access layers:

public class Business
{
     public void ReadFiles(Imagelist img)
     {
     }
}



因为imagelist在类库项目中不是有效的类型.有人有什么建议吗?
谢谢.



Because the imagelist is not a valid type within a class library project. Anyone have any suggestions?
Thank you.

推荐答案

如果您绝对必须访问类库中的ImageList类,则该库只需要添加对System.Windows.Forms的引用.
我会遇到的更大问题是这个.如果您认为需要,可能会遇到体系结构问题.您应该只发送图像列表或类似的列表,而不是ImageList控件.
If you absolutely have to access the ImageList class in a class library, that library just needs to have a reference to System.Windows.Forms added.
The bigger issue I would have is this. There is likely an architectural issue at hand if you feel you require it. You should simply be sending a List of images or something like that around rather than an ImageList control.


这篇关于如何将控制图像列表作为参数传递给其他图层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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