Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello , i need code for put red point in image ,such as the point for google map to see the people where live ?
Posted

Hi, I hope this helps you.
Add cross in image

C#
using (Image image = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Koala.jpg"))
using (Graphics imageGraphics = Graphics.FromImage(image))
{
    ///point for draw cross
    Point point = new Point(image.Width / 2, image.Height / 2);
    imageGraphics.DrawLine(new Pen(Color.Red), point.X - 5, point.Y, point.X + 5, point.Y);
    imageGraphics.DrawLine(new Pen(Color.Red), point.X, point.Y - 5, point.X, point.Y + 5);
    image.Save(@"C:\Users\Public\Pictures\Sample Pictures\test2.jpg");

}

But if you want to use the maps directly. so here is the code (use the library Google.Api.Maps.Service.dll)

C#
var map = new StaticMap();
         map.Center = "49.78173 13.36669";
         map.Zoom = "17";
         map.Size = "500x400";
         map.Sensor = "true";
         map.Markers = "49.78173 13.36669";

         using (var wc = new WebClient())
         {

             pictureBox1.Image = Image.FromStream(wc.OpenRead(map.ToUri()));
         }
 
Share this answer
 
v2
Comments
ahmed200 30-Jul-13 17:42pm    
how to this in vb.net not in c#
This is a super tool for converting C # / VB http://www.developerfusion.com/tools/convert/csharp-to-vb/
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900