using System; using System.Windows.Forms; using ThinkGeo.MapSuite.Core; using ThinkGeo.MapSuite.DesktopEdition; namespace CSharpWinformsSamples { public partial class AddSimpleMarkers : UserControl { public AddSimpleMarkers() { InitializeComponent(); } private void Form_Load(object sender, EventArgs e) { winformsMap1.MapClick += new EventHandler(winformsMap1_MapClick); winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9); WorldMapKitWmsDesktopOverlay worldMapKitOverlay = new WorldMapKitWmsDesktopOverlay(); winformsMap1.Overlays.Add(worldMapKitOverlay); //winformsMap1.Overlays.Add("MarkerOverlay", markerOverlay); winformsMap1.Refresh(); } private void winformsMap1_MapClick(object sender, MapClickWinformsMapEventArgs e) { SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay(); markerOverlay.MapControl = winformsMap1; Marker marker = new Marker(e.WorldLocation); marker.Image = Properties.Resources.AQUA; marker.Width = 20; marker.Height = 34; marker.YOffset = -17; markerOverlay.Markers.Add(marker); winformsMap1.Overlays.Add(markerOverlay); winformsMap1.Refresh(); } #region Component Designer generated code private System.ComponentModel.IContainer components = null; private GroupBox gbxDescrition; private WinformsMap winformsMap1; private Label label1; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.gbxDescrition = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); this.winformsMap1 = new ThinkGeo.MapSuite.DesktopEdition.WinformsMap(); this.gbxDescrition.SuspendLayout(); this.SuspendLayout(); // // gbxDescrition // this.gbxDescrition.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.gbxDescrition.Controls.Add(this.label1); this.gbxDescrition.Location = new System.Drawing.Point(480, -1); this.gbxDescrition.Name = "gbxDescrition"; this.gbxDescrition.Size = new System.Drawing.Size(257, 55); this.gbxDescrition.TabIndex = 4; this.gbxDescrition.TabStop = false; this.gbxDescrition.Text = "Description"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(7, 20); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(251, 26); this.label1.TabIndex = 0; this.label1.Text = "This sample shows how to add markers by click\r\n event on the map."; // // winformsMap1 // this.winformsMap1.BackColor = System.Drawing.Color.White; this.winformsMap1.Dock = System.Windows.Forms.DockStyle.Fill; this.winformsMap1.Location = new System.Drawing.Point(0, 0); this.winformsMap1.Name = "winformsMap1"; this.winformsMap1.Size = new System.Drawing.Size(740, 528); this.winformsMap1.TabIndex = 5; this.winformsMap1.Text = "winformsMap1"; // // AddMyOwnCustomDataToAFeatureLayer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.gbxDescrition); this.Controls.Add(this.winformsMap1); this.Name = "AddMyOwnCustomDataToAFeatureLayer"; this.Size = new System.Drawing.Size(740, 528); this.Load += new System.EventHandler(this.Form_Load); this.gbxDescrition.ResumeLayout(false); this.gbxDescrition.PerformLayout(); this.ResumeLayout(false); } #endregion } }