Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# GDI+ graphics
Hello Experts
I need to draw an Google marker image via C# Graphics
for that i;ll need the exact coordinates of Google marker
how can i do that Please help .
My Current Code is .

 
private void Shape8(PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
 
            int startMarker = 0;
            int MarkerDiameter = 30;
            int EllipseDiameter = 15;
 
            const int StartX = 150;
            const int StartY = 350;
 
            int X = StartX;
            int Y = StartY;
 
            GraphicsPath path = new GraphicsPath();
            Rectangle ellipse = new Rectangle(X, Y, EllipseDiameter, EllipseDiameter);
            path.AddEllipse(ellipse);
            path.CloseFigure();
 
            X = X + (EllipseDiameter / 2) - (MarkerDiameter / 2);
            Y = Y - (EllipseDiameter * 2) - (MarkerDiameter / 2);
 
            startMarker = StartY - 10 - (Convert.ToInt32(MarkerDiameter * 1.5));//Space Between marker and circle.
            AddMarker8(ref path, X, startMarker, StartX, StartY, EllipseDiameter, MarkerDiameter, "Concept1");
 
            e.Graphics.FillPath(Brushes.Pink, path);
            e.Graphics.DrawPath(Pens.Black, path);
            e.Graphics.FillEllipse(Brushes.White, ellipse);
 
            path.CloseAllFigures();
 
        }
 
 private void AddMarker8(ref GraphicsPath path, int X, int Y, int StartX, int StartY, int EllipseDiameter, int MarkerDiameter, string conceptName)
        {
            float startAngle = 180.0F;
            float sweepAngle = 180.0F;
            int fontStyle = (int)FontStyle.Regular;
 
            path.AddString(conceptName, new FontFamily("Arial"), fontStyle, 15, new Point(X + (MarkerDiameter / 2), Y - 15), lblFormat);
            Rectangle rect = new Rectangle(X, Y, MarkerDiameter, MarkerDiameter);
            path.AddArc(rect, startAngle, sweepAngle);
 
            Point lastpoint = new Point(X + (MarkerDiameter / 2), (Y + (MarkerDiameter * 2)) - (MarkerDiameter / 2));
            path.AddCurve(new Point[] {
                new Point(X+(MarkerDiameter), Y + (MarkerDiameter / 2)), //a
                new Point((X +MarkerDiameter)-(MarkerDiameter/4) ,(Y +(MarkerDiameter ))) ,//A.5
                lastpoint ,//c
                new Point(X +(MarkerDiameter / 4) ,(Y +(MarkerDiameter ))) ,//B.5
                new Point(X, Y + (MarkerDiameter / 2))//b
                    }, 0.5f);
 
            path.CloseFigure();
        }
Posted 25-Jun-13 4:41am
Edited 25-Jun-13 4:45am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I don't know C#, but for javascript ,it is easy to call google map api to replace marker with your own,why you do function what google already have?
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 190
1 PIEBALDconsult 150
2 BillWoodruff 148
3 DamithSL 140
4 Jochen Arndt 125
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 5 Mar 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100