예제 #1
0
        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);
            }
        }
예제 #2
0
        /// <summary>
        /// 另存为新地图文档(弹出对话框选择保存地址)
        /// </summary>
        public void SaveAs()
        {
            var filePath = DialogOpt.ShowSaveFileDialog(@"地图文档(*.mxd)|*.mxd", @"保存地图文档", @"地图文档");

            if (filePath != null)
            {
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }

                MapDoc = new MapDocumentClass();
                MapDoc.New(filePath);
                MapDoc.ReplaceContents(MapControl.Map as IMxdContents);
                MapDoc.Save();
            }
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        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;
            }
        }