Click here to Skip to main content
15,891,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I like the picture I want to make my info box
//Picture
http://i.hizliresim.com/aqB15Q.png

C#
GMap1.addGMapUI(new GMapUI());
        GMap1.GZoom = 2;

        GMap2.addGMapUI(new GMapUI());
        GMap2.GZoom = 2;

        List<GMarker> markers = new List<GMarker>();
        double[] aaa1 = new double[3];
        double[] aaa2 = new double[3];
        string[] stdize = new string[3];

        aaa1[0] = 39.5;
        aaa2[0] = -3.4;
        aaa1[1] = 39.1;
        aaa2[1] = -3.1;
        aaa1[2] = 38.8;
        aaa2[2] = -2.8;
        stdize[0] = "<center><div class=\"box\">bilgi kutum!</div></center>";
        stdize[1] = "<div class=\"box\">bilgi kutum!</div>";
        string url="http://www.google.com.tr";
        stdize[2] = "<a href="+url+">deneme</a>";

        string html_text = "<center><div class=\"csstest\"><table><tr><td>Title 1</td></tr><tr><td>Row 1</td></tr>" +
        "<tr><td>Row 2</td></tr><tr><td>Row 2</td></tr><tr><td>Row 3</td></tr></table></div></center>";
 
  
        Random r = new Random();
        GIcon icon = new GIcon();
        GMarker mkr;
        icon.image = "http://i.hizliresim.com/9Xvp95.png";
        icon.shadow = "http://i.hizliresim.com/krZY1D.png";

        icon.iconSize = new GSize(32, 32);
        icon.shadowSize = new GSize(56, 32);
        icon.iconAnchor = new GPoint(16, 32);
        icon.infoWindowAnchor = new GPoint(16, 0);
        for (int i = 0; i < 3; i++)
        {
            GMarker gMarker = new GMarker(new GLatLng(aaa1[i], aaa2[i]),icon);
            markers.Add(gMarker);
            //{0}
            //string fakir = @"function () {{ var w = new google.maps.InfoWindow(); w.setContent('" + stdize[i] + "'); w.open({1}, {2});}}";
            
            string fakir = @"function () {{ var w = new google.maps.InfoWindow(); w.setContent('" + html_text + "'); w.open({1}, {2});}}";
           // string fakir = @"function () {{ var w = new google.maps.InfoWindow(); w.setContent('" + html_text + "');}}";
            GListener listener = new GListener(gMarker.ID, GListener.Event.click, string.Format(fakir, i, GMap1.GMap_Id, gMarker.ID));
            
            GMap1.Add(listener);
          
        }

        GMap2.markerClusterer = new MarkerClusterer(markers);


        MarkerClustererStyleOptions markerClustererStyleOptions = new MarkerClustererStyleOptions();
        markerClustererStyleOptions.textColor = Color.Yellow;

        MarkerClustererOptions markerClustererOptions = new MarkerClustererOptions(60, 10);


        MarkerClustererStyleOptions styleOptionsA = new MarkerClustererStyleOptions();
        styleOptionsA.height = 36;
        styleOptionsA.width = 40;
        styleOptionsA.anchor_x = 6;
        styleOptionsA.anchor_y = 0;
        styleOptionsA.textColor = Color.Blue;
        styleOptionsA.url = "http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/conv40.png";

        MarkerClustererStyleOptions styleOptionsB = new MarkerClustererStyleOptions();
        styleOptionsB.height = 35;
        styleOptionsB.width = 35;
        styleOptionsB.anchor_x = 16;
        styleOptionsB.anchor_y = 0;
        styleOptionsB.textColor = Color.WhiteSmoke;
        styleOptionsB.url = "http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/people35.png";




        markerClustererOptions.markerClustererStylesOptions.Add(styleOptionsA);
        markerClustererOptions.markerClustererStylesOptions.Add(styleOptionsB);


        MarkerClusterer markerClusterer = new MarkerClusterer(markers, markerClustererOptions);
GMap1.markerClusterer = markerClusterer;
Posted
Updated 10-Apr-14 12:31pm
v2
Comments
Jignesh Khant 11-Apr-14 1:25am    
First of all let me tell you that the code you have posted is of Google Map V2 which google has blocked from Nov 2013 onwards. So try making your application using Google map v3. v2 wont work now.
serdarozkan41 11-Apr-14 7:06am    
Do you have a suggestion? Can I dynamically with JavaScript?

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