private void MainForm_Shown(object sender, EventArgs e) { // Don't define the model until the screen gets shown for the first time. Otherwise // the map control may end up saving an incorrect screen image. string fileName = Settings.Default.LastMap; if (File.Exists(fileName)) { ISpatialData data = new ShapeFile(fileName); m_Controller.ShapeFileName = fileName; m_Controller.SetMapModel(new SimpleMapModel(data), null); } // All properties are readonly, and by default they will show up in // a pale grey that's difficult to see. Change it to black so the // info can be seen without squinting (the fact that the fields can't // be edited will be apparent when the user tries to do it). Actually, // changing it to black seems to be a special case, where the text // continues to comes out grey. So change it to nearly black. propertyGrid.ViewForeColor = Color.FromArgb(1, 0, 0); //SystemColors.ControlText; // Color.Black; // Ensure the map control has focus, so that things like the ESC key will be recognized //mapControl.Focus(); }
private void FileOpen(IUserAction action) { OpenFileDialog dial = new OpenFileDialog(); String fileName = (dial.ShowDialog() == DialogResult.OK ? dial.FileName : null); dial.Dispose(); if (fileName == null) { return; } ISpatialData data = new ShapeFile(fileName); m_Controller.ShapeFileName = fileName; m_Controller.SetMapModel(new SimpleMapModel(data), null); Settings.Default.LastMap = fileName; Settings.Default.Save(); }
private void FileOpen(IUserAction action) { OpenFileDialog dial = new OpenFileDialog(); String fileName = (dial.ShowDialog()==DialogResult.OK ? dial.FileName : null); dial.Dispose(); if (fileName==null) return; ISpatialData data = new ShapeFile(fileName); m_Controller.ShapeFileName = fileName; m_Controller.SetMapModel(new SimpleMapModel(data), null); Settings.Default.LastMap = fileName; Settings.Default.Save(); }