Reputation: 5469
How to use e.g. bitmap from resources instead of physical image file in class MigraDoc.DocumentObjectModel.Tables.Cell
in method public Image AddImage(string fileName);
?
Upvotes: 1
Views: 2042
Reputation: 8079
If you've added an image with the name "myImage" to your projects resources use this code:
Properties.Resources.myImage
In your example adjust the parameter:
public Image AddImage(Image img);
And call it like this:
AddImage(Properties.Resources.myImage);
If it is required to pass a filename just write the Image to a file first (perhaps to the temp directory):
string fileName = "C:\\image.jpg";
((Bitmap)Properties.Resources.myImage).Save(fileName, ImageFormat.Jpeg);
AddImage(fileName);
Upvotes: 3