private void Form1_Load(object sender, System.EventArgs e) { m_MapControl = (IMapControl2)axMapControl1.GetOcx(); //Find sample data string filePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); filePath = System.IO.Path.Combine(filePath, @"ArcGIS\data\World"); //Add sample shapefile data m_MapControl.AddShapeFile(filePath, "world30"); m_MapControl.AddLayerFromFile(System.IO.Path.Combine(filePath, @"continents.lyr"), 0); //Symbolize the data SymbolizeData(m_MapControl.get_Layer(0), 0.1, GetRGBColor(0, 0, 0), GetRGBColor(0, 128, 0)); SymbolizeData(m_MapControl.get_Layer(1), 0.1, GetRGBColor(0, 0, 0), GetRGBColor(140, 196, 254)); //Set up a global Geographic Coordinate System MakeCoordinateSystems(); //Get the MapControl's graphics container and get the IGraphicsContainer interface m_GraphicsContainer = m_MapControl.ActiveView.GraphicsContainer; //Populate an array with agent id's and locations LoadAgentArray(); //Loop through the array and display each agent location for (int i = 0; i <= 19; i++) { DisplayAgentLocation(agentArray[i]); } timer1.Interval = 800; }
public Map2DView() { try { DF2DApplication app = DF2DApplication.Application; InitializeComponent(); DF2DApplication.Application.Current2DMapControl = (IMapControl2)this.axMapControl.GetOcx(); mapControlEvents = axMapControl.GetOcx() as IMapControlEvents2_Event; mapControlEvents.OnMapReplaced += new IMapControlEvents2_OnMapReplacedEventHandler(mapEvent_OnMapReplaced); mapControlEvents.OnExtentUpdated += new IMapControlEvents2_OnExtentUpdatedEventHandler(mapControlEvents_OnExtentUpdated); } catch (Exception ex) { LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace); } }
public EagleEyePad() { try { InitializeComponent(); mapControlEvents = axMapControl.GetOcx() as IMapControlEvents2_Event; mapControlEvents.OnMapReplaced += new IMapControlEvents2_OnMapReplacedEventHandler(mapEvent_OnMapReplaced); mapControlEvents.OnMouseMove += new IMapControlEvents2_OnMouseMoveEventHandler(mapControlEvents_OnMouseMove); mapControlEvents.OnMouseDown += new IMapControlEvents2_OnMouseDownEventHandler(mapControlEvents_OnMouseDown); mapControlEvents.OnMouseUp += new IMapControlEvents2_OnMouseUpEventHandler(mapControlEvents_OnMouseUp); } catch (Exception ex) { LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace); } }