private void PictureBox1_Click(object sender, EventArgs e) { var extension = "*.bmp;*.gif;*.jpg;*.jpeg;*.gif;*.png;*.ico|*.bmp;*.gif;*.jpg;*.jpeg;*.gif;*.png;*.ico"; if (_sourceImgDir == null) { _sourceImgDir = ImageDir; } var filePath = DialogOpt.ShowOpenFileDialog(extension, "选择图标", null, _sourceImgDir); if (filePath != null) { this.pictureBox1.Image = Image.FromFile(this.txtIcon.Text = filePath); } }
/// <summary> /// 打开地图文档并加载地图到地图控件中(若当前地图文档非空则先保存地图文档) /// </summary> /// <returns></returns> public IMapDocument OpenDoc() { var filePath = DialogOpt.ShowOpenFileDialog(@"*.mxd|*.mxd"); if (filePath != null) { if (MapDoc != null) { Save(); } MapDoc = new MapDocumentClass(); MapDoc.Open(filePath); MapControl.Map = MapDoc.ActiveView.FocusMap; MapControl.ActiveView.Refresh(); } return(MapDoc); }
private void BtnSelectIcon_Click(object sender, EventArgs e) { var extension = "*.bmp;*.gif;*.jpg;*.jpeg;*.gif;*.png;*.ico|*.bmp;*.gif;*.jpg;*.jpeg;*.gif;*.png;*.ico"; if (_sourceImgDir == null) { _sourceImgDir = AppImageDir; } var filePath = DialogOpt.ShowOpenFileDialog(extension, "选择图标", null, _sourceImgDir); if (filePath != null) { _sourceImgDir = Path.GetDirectoryName(filePath); if (AppImageDir != _sourceImgDir) { var newPath = Path.Combine(AppImageDir, DateTime.Now.Ticks.ToString() + Path.GetExtension(filePath)); Directory.CreateDirectory(AppImageDir); File.Copy(filePath, newPath); filePath = newPath; } this.pictureBox1.Image = Image.FromFile(filePath); this.txtIcon.Text = filePath; } }