private void btnMapSelect_Click(object sender, EventArgs e) { frmDpicDialog ofd = new frmDpicDialog(); if (ofd.ShowDialog() == DialogResult.OK) { DataTable dt = dpicbll.GetBackPicByFileID(ofd.FileID); try { this.picMap.Image = this.BytesToImage((byte[])dt.Rows[0][0]); //this.MapFilePath = Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName; this.FileID = ofd.FileID; this.MapConfiged = true; XmlNode node = ConfigXml.SelectSingleNode("//Map"); if (node != null) { node.InnerText = ofd.FileID; } else { XmlNode newnode = ConfigXml.CreateElement("Map"); newnode.InnerText = ofd.FileID; RootNode.AppendChild(newnode); } } catch (Exception ex) { MessageBox.Show("无法识别的图片!", "提示", MessageBoxButtons.OK); } } }
private void btnMapSelect_Click(object sender, EventArgs e) { frmDpicDialog ofd = new frmDpicDialog(); if (ofd.ShowDialog() == DialogResult.OK) { DataTable dt = dpicbll.GetBackPicByFileID(ofd.FileID); try { this.picMap.Image = this.BytesToImage((byte[])dt.Rows[0][0]); //this.MapFilePath = Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName; this.FileID = ofd.FileID; this.MapConfiged = true; XmlNode node = ConfigXml.SelectSingleNode("//Map"); if (node != null) { node.InnerText = ofd.FileID; } else { XmlNode newnode = ConfigXml.CreateElement("Map"); newnode.InnerText = ofd.FileID; RootNode.AppendChild(newnode); } this.isSaveed = false; } catch (Exception ex) { MessageBox.Show("无法识别的图片!", "提示", MessageBoxButtons.OK); } } dmc.ScrollControlIntoView(this.NowBtn); }
private void FrmRouteConfig_Load(object sender, EventArgs e) { try { frmDpicDialog ofd = new frmDpicDialog(); if (ofd.ShowDialog() == DialogResult.OK) { this.FileID = ofd.FileID; try { DataTable dt = dpicbll.GetBackPicByFileID(FileID); byte[] buffer = (byte[])dt.Rows[0][0]; Graphics.Config.FileChanger fc = new KJ128NMainRun.Graphics.Config.FileChanger(); if (!System.IO.Directory.Exists(Application.StartupPath + "\\MapGis\\DMap")) { System.IO.Directory.CreateDirectory(Application.StartupPath + "\\MapGis\\DMap"); } fc.CreateFile(Application.StartupPath + "\\MapGis\\DMap\\" + ofd.FileName, buffer); this.MapGis.MapFilePath = Application.StartupPath + "\\MapGis\\DMap\\" + ofd.FileName; System.IO.File.Delete(Application.StartupPath + "\\MapGis\\DMap\\" + ofd.FileName); } catch (Exception ex) { SetBtnEnabel(false); MessageBox.Show("无法识别的图片!", "提示", MessageBoxButtons.OK); return; } } else { //this.Close(); this.btnRollback.Enabled = false; this.btnSave.Enabled = false; this.btnCreate.Enabled = false; return; } if (System.IO.File.Exists(StationFilePath)) { this.MapGis.StationFilePath = StationFilePath; } else { SetBtnEnabel(false); MessageBox.Show("您所配置的图形加载失败,请重新配置后使用..", "提示", MessageBoxButtons.OK); return; } if (isConfiged) { DataTable stationdt = dpicbll.GetStationHeadByFileID(FileID); if (stationdt != null && stationdt.Rows.Count > 0) { AddStationToMapGis(stationdt); } this.MapGis.StartSetting(); } } catch (ArgumentException ex) { SetBtnEnabel(false); MessageBox.Show("您所配置的图形加载失败,请重新配置后使用..", "提示", MessageBoxButtons.OK); } }