private void More_Click(object sender, EventArgs e) { EventResume template = (EventResume)((Control)sender).Parent; EventDetail myEventDetail = new EventDetail(template.MyEvent); pnl_EventDetails.Controls.Add(myEventDetail); MyMaps.Hide(); }
private void DisplayEvents() { int nbEvents = myModelEvent.GetEvents(); // Create a overlay GMapOverlay markers = new GMapOverlay("markers"); // Affiche les amis de foreach (Event e in myModelEvent.Events_list) { cpt++; EventResume eventResume = new EventResume(e) { Name = "EventResume" + cpt.ToString(), Parent = pnl_EventsResume, Dock = DockStyle.Top }; foreach (Control c in eventResume.Controls) { if (c is PictureBox) { c.Click += More_Click; } else { c.Click += EventResume_Click; } } eventResume.Click += EventResume_Click; pnl_EventsResume.Controls.Add(eventResume); PointLatLng point = new PointLatLng(e.Lat, e.Lng); GMapMarker marker = new GMarkerGoogle(point, GMarkerGoogleType.red_dot) { ToolTipText = e.Name, }; // Add marker on overlay markers.Markers.Add(marker); } lbl_AllEvent.Text = "Tous les évènements (" + nbEvents + ")"; // Cover map whith overlay MyMaps.Overlays.Add(markers); }