C#嵌入图像,报告,模式 [英] C# embedding images, reports, schemas

查看:62
本文介绍了C#嵌入图像,报告,模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了一些示例,但是试图更好地理解资源文件的工作方式,例如嵌入图像,报表,模式等。

I've seen some examples, but trying to better understand how "Resource" files work, such as embedding images, reports, schemas, etc.

如果要构建一个应用程序,我想确保部署时一切都可用,但是对于报表和架构之类的东西,我不希望任何人不小心删除,重命名或以其他方式弄乱事物的内容。因此,嵌入这些类型的项目似乎很有意义。然后,我只是通过资源管理器通过dll进行访问。

If building an application, I want to make sure everything is available when deployed, but for things like reports and schemas, I don't want anyone accidentally deleting, renaming, or otherwise mucking around with the content of things. So, embedding these types of items appears to make sense. Then, I just access via the dll via the resources manager.

由于我尚未执行此操作……我是否认为我最终部署的内容会正确?是一堆dll,在继续运行该应用之前,我可以进行检查以确保所有必需的条件都存在。然后,我可以从资源 dll程序集中得到所有报告和模式。

Since I have not done this yet... Am I correct in the assumption that my final deployed stuff will be a bunch of dlls, and I can check to make sure all required exist before continuing the app. Then, all the reports and schemas I can get out of the "resource" dll assembly.

另外,因为我已经有一些大约5个报告的示例,它们也相应不在资源文件中的模式,将这些现有元素添加到资源文件中并能够运行它们所涉及的内容。我知道它们本身似乎都具有一些嵌入式路径,例如报告知道其架构来自何处。如果实际的文件不是部署的一部分,而只是从资源中提取出来的,它会阻塞吗?

Additionally, since I already have some samples of about 5 reports, and their corresponding schemas that are NOT in a "resource" file, what is involved with adding these existing elements into a "resource" file and being able to run them. I know they all appear to have some embedded pathing things themselves, such as the report knowing where it's schema is coming from. If the actual files are not part of the deployment, just extracted from the "resource", will it choke?

希望这一切都是合理的,因为这是资源利用的领域文件对我来说相对较新。

Hope this is all making sense as this area of utilizing resource files is relatively new to me.

谢谢

推荐答案

工作室,这几乎是拖放操作:

For visual studio, it's pretty much drag and drop:


  1. 创建资源文件

  2. 打开资源文件

  3. 切换到文件视图

  4. 将文件从Solution Explorer拖放到设计图面

  5. 保存

  1. Create resource file
  2. Open resource file
  3. Switch to files view
  4. Drag files from Solution Explorer into design surface
  5. Save

到那时,将创建一个访问器类。访问器类将具有与资源文件的基本名称相同的名称。根据文件内容的类型,每个嵌入式文件都将具有字节数组或字符串属性。

At that point, an accessor class will have been created. The accessor class will have the same name as the base name of the resource file. Depending on the type of content of the files, it will have either a byte-array or string property for each embedded file.

还有其他方法可以实现,但没有就是这么简单。

There are other ways to do it but none are as simple as that.

这篇关于C#嵌入图像,报告,模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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