private void selectBgBtn_Click(object sender, EventArgs e) { DialogResult result = selectBgDlg.ShowDialog(); // Show the dialog. if (result == DialogResult.OK) // Test result. { selectBgFilePath.Text = selectBgDlg.FileName; ImportImageForm form = new ImportImageForm(); form.SetImage(selectBgDlg.FileName); if (form.HasJgw() || DialogResult.OK == form.ShowDialog()) { imgInfoBtn.Enabled = true; RiverSimulationProfile.profile.SetImportImage(selectBgDlg.FileName, form.e, form.n, form.w, form.h); mapPicBox.SetMapBackground(selectBgDlg.FileName, form.e, form.n, form.w, form.h); SwitchPreivewCombo(PreviewType.GridMap); UpdateStatus(); } else { selectBgFilePath.Text = ""; } } }