如何获得在.NET Properties.Resources.Image路径 [英] How to get path of Properties.Resources.Image in .NET

查看:303
本文介绍了如何获得在.NET Properties.Resources.Image路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我包括图像如下这个帖子的资源: 如何创建和使用资源的.NET

I included an image as a resource following this post: How to create and use resources in .NET

我使用PDFSharp库来创建一个PDF文件。绘制图像的方法中,需要的图像的路径。我如何获得 Properties.Resources.Image

I am using PDFSharp library to create a PDF. The method to draw an image, requires the path of the image. How do I get the path of Properties.Resources.Image?

或者有另一种方式做到这一点?

Or is there another way to do this?

推荐答案

Properties.Resources.Image 的内存资源。

您可以保存图片到临时文件和获取路径。

You can save Image to temp file and the get the path.

var path = Path.GetTempPath();
Properties.Resources.logo.Save(path);

以上使用 Bitmap.Save

这篇关于如何获得在.NET Properties.Resources.Image路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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