ThinkGeo Cloud
ThinkGeo UI Controls
ThinkGeo Open Source
Help and Support
External Resources
ThinkGeo Cloud
ThinkGeo UI Controls
ThinkGeo Open Source
Help and Support
External Resources
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using ThinkGeo.MapSuite.Core; using ThinkGeo.MapSuite.DesktopEdition; namespace MDIform { public partial class childForm : Form { public childForm() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { WinformsMap winformsMap1 = (WinformsMap)this.Parent; LayerOverlay layerOverlay = (LayerOverlay)winformsMap1.Overlays["PointOverlay"]; InMemoryFeatureLayer inMemoryFeatureLayer = (InMemoryFeatureLayer)layerOverlay.Layers[0]; inMemoryFeatureLayer.Open(); inMemoryFeatureLayer.EditTools.BeginTransaction(); PointShape pointShape = new PointShape(Convert.ToDouble(txtX.Text),Convert.ToDouble(txtY.Text)); inMemoryFeatureLayer.EditTools.Add(new Feature(pointShape)); inMemoryFeatureLayer.EditTools.CommitTransaction(); inMemoryFeatureLayer.Close(); winformsMap1.Refresh(layerOverlay); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using ThinkGeo.MapSuite.Core; using ThinkGeo.MapSuite.DesktopEdition; namespace MDIform { public partial class MDIParent1 : Form { public MDIParent1() { InitializeComponent(); Form childForm1 = new childForm(); childForm1.MdiParent = this; childForm1.Parent = winformsMap1; childForm1.Show(); } private void MDIParent1_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.CurrentExtent = new RectangleShape(-125, 47, -67, 25); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255)); //Displays the World Map Kit as a background. ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay(); winformsMap1.Overlays.Add(worldMapKitDesktopOverlay); InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer(); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 12, GeoColor.StandardColors.Black, 2); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add("Point",inMemoryFeatureLayer); winformsMap1.Overlays.Add("PointOverlay",layerOverlay); winformsMap1.Refresh(); } private void winformsMap1_MouseMove(object sender, MouseEventArgs e) { //Displays the X and Y in screen coordinates. statusStrip1.Items["toolStripStatusLabelScreen"].Text = "X:" + e.X + " Y:" + e.Y; //Gets the PointShape in world coordinates from screen coordinates. PointShape pointShape = ExtentHelper.ToWorldCoordinate(winformsMap1.CurrentExtent, new ScreenPointF(e.X, e.Y), winformsMap1.Width, winformsMap1.Height); //Displays world coordinates. statusStrip1.Items["toolStripStatusLabelWorld"].Text = "(world) X:" + Math.Round(pointShape.X, 4) + " Y:" + Math.Round(pointShape.Y, 4); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace MDIform { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MDIParent1()); } } }