如何在图像中添加图像,并使用控制台应用程序邮寄此图像? [英] How to add image within image , and mail this image using console application?
问题描述
早上好,
我已经创建了一个控制台应用程序,它按计划运行。
现在我有一个电子邮件工具,我发送一个图像使用http://maps.googleapis.com/maps/api/staticmap?center = ........此路径及其X任何Y中心都通过我的控制台应用程序。
现在这个googlemap是我的主要图像,因为我想放置标记图像(我的图像在我的控制台应用程序中,标记图像将根据X和Y中心放置)。 br />
主图像是谷歌地图,因为我想要我的标记图像(图像中的图像)。
我知道有AlternateView和LinkedResource。
i就像这样使用
eg linkedResource.ContentId =image1;
Good Morning ,
I have create one console application , its runs by schedule.
Now i have one facility of email , in that i am sending one image which uses "http://maps.googleapis.com/maps/api/staticmap?center=........" this path and its X any Y centers are coming through my console application .
Now this googlemap is my main image , in that i want to put marker image(my image which is in my console application and marker image will be put according to X and Y center).
Main image is google map , in that i want to my marker image (image within image).
I know there is AlternateView and LinkedResource.
i used that like this way
e.g. linkedResource.ContentId = "image1";
string imgURL = "http://maps.googleapis.com/maps/api/staticmap?center=X,Y&size=640x450&markers=icon:\"cid:image1\"?color:blue|label:v|X,Y&sensor=false";
// this mail message string
string mailMessage += "<a href=@"google.com">";
mailMessage += "<img alt=\"Enable image to view Map\" src=" + imgURL + " />";
mailMessage += "</a><br /><br/>";
但它无效.Marker图像显示在附件中,我想把它(标记图像)放在第一张图片说谷歌地图。
以前这个应用程序运行正常,因为标记图像在服务器上,但现在我不想使用服务器图像,我想使用图像,这是/将在控制台应用程序中。
如果任何人有任何想法让我。
谢谢。
but its not working .Marker image is displayed in attachment and i want to put it (marker image) in first image say google map.
Previously this app was run fine , because marker image was on server , but now i dont want to use server image , i want to use image , that is/will be in console application.
If any one have any idea let me.
Thank you.
推荐答案
很明显,首先你应该准备你想要的图像,这是两个图像的组合,一个在另一个上面(背景上的前景图像) )。您可以使用System.Drawing
轻松完成。
关键是:绘制一些位图,你应创建一个位图,然后从此位图获取System.Drawing.Graphics
的实例,并使用此实例进行绘制。具体方法如下: http://msdn.microsoft .com / zh-cn / library / system.drawing.graphics.fromimage(v = vs.110).aspx [ ^ ]。
并且,要绘制图像,请使用一个或多个System.Drawing.DrawImage
方法:
http://msdn.microsoft.com/en-us/library/system。 drawing.graphics%28v = vs.110%29.aspx [ ^ ]。
它还取决于这些属性:
http:// msdn .microsoft.com / EN-U s / library / system.drawing.graphics.compositingmode%28v = vs.110%29.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system。 drawing.graphics.compositingquality%28v = vs.110%29.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.interpolationmode% 28v = vs.110%29.aspx [ ^ ]。
-SA
It is apparent that first you should prepare the image you want, which is a combination of two images, one on top of another (foreground image on a background). You can easily do it usingSystem.Drawing
.
The key is: to draw on some bitmap, you should create a bitmap, and than obtain an instance ofSystem.Drawing.Graphics
from this bitmap and draw using this instance. This is how: http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage(v=vs.110).aspx[^].
And, to draw an image, use one or more of theSystem.Drawing.DrawImage
methods:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics%28v=vs.110%29.aspx[^].
It also depends on these properties:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.compositingmode%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.compositingquality%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.interpolationmode%28v=vs.110%29.aspx[^].
—SA
这篇关于如何在图像中添加图像,并使用控制台应用程序邮寄此图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!