private void BrowseBtn_Click(object sender, EventArgs e) { if (MyFolderBrowserDialog.ShowDialog() == DialogResult.OK) { BackupPathTxt.Text = MyFolderBrowserDialog.SelectedPath; } }
//3:浏览文件夹 private void BrowseLabel_Click(object sender, System.EventArgs e) { if (MyFolderBrowserDialog.ShowDialog() == DialogResult.OK) { ResultLabel.Text = "你的选择是:" + MyFolderBrowserDialog.SelectedPath; } }
private void MyKeyPress(object sender, KeyEventArgs e) { if ((ModifierKeys & Keys.Shift) == Keys.Shift) { switch (e.KeyCode) { case Keys.Right: next100Images(); break; case Keys.Left: previous100Images(); break; default: break; } } else { switch (e.KeyCode) { case Keys.H: MyTextBox.Visible = !MyTextBox.Visible; break; case Keys.Escape: Application.Exit(); break; case Keys.Right: nextImage(); break; case Keys.Left: previousImage(); break; case Keys.NumPad1: if (score != null) { score[MyPosition] = 1; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad2: if (score != null) { score[MyPosition] = 2; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad3: if (score != null) { score[MyPosition] = 3; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad4: if (score != null) { score[MyPosition] = 4; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad5: if (score != null) { score[MyPosition] = 5; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad6: if (score != null) { score[MyPosition] = 6; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad7: if (score != null) { score[MyPosition] = 7; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad8: if (score != null) { score[MyPosition] = 8; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad9: if (score != null) { score[MyPosition] = 9; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.NumPad0: if (score != null) { score[MyPosition] = 0; MyLabelScore.Text = score[MyPosition].ToString(); nextImage(); } else { Console.Beep(); } break; case Keys.O: if (MyFolderBrowserDialog.ShowDialog() == DialogResult.OK) { MyPosition = 0; if (files != null) { Array.Clear(files, 0, files.Length); Console.Beep(); } //Array.Clear(score, 0, score.Length); MySourceFolder = MyFolderBrowserDialog.SelectedPath; files = GetFilesFrom(MySourceFolder, filters, false); if (Path.GetFileNameWithoutExtension(files[MyPosition]).Length == 54) { Array.Sort(files, (a, b) => string.Compare(Path.GetFileNameWithoutExtension(a).Substring(46, 8), Path.GetFileNameWithoutExtension(b).Substring(46, 8))); //MyPosMax = files.Length; //MyLabelScore.Text = MyPosMax.ToString(); MyPictureBox_2.Image = Image.FromFile(files[MyPosition]); MyMaximum = files.Length; //MyLabelScore.Text = Path.GetFileNameWithoutExtension(files[1]).Substring(46, 8);// files[1].Substring(55, 8).ToString(); score = new int[files.Length]; for (int i = 0; i < score.Length; i++) { score[i] = -1; } MyLabelScore.Text = score[MyPosition].ToString(); MyLabelFilename.Text = Path.GetFileNameWithoutExtension(files[MyPosition]); MyProgressbar.Maximum = files.Length - 1; MyProgressbar.Value = MyPosition; MyLabelPosition.Text = MyPosition.ToString(); MyLabelMaximum.Text = MyMaximum.ToString(); } else { MessageBox.Show("Filenames do not match expected scheme"); } } break; case Keys.W: writeResults(); break; case Keys.J: MyLabelFilename.Visible = !MyLabelFilename.Visible; MyLabelPosition.Visible = !MyLabelPosition.Visible; MyProgressbar.Visible = !MyProgressbar.Visible; MyLabelMaximum.Visible = !MyLabelMaximum.Visible; break; case Keys.F: MyPictureBox_2.Width = this.Width; MyPictureBox_2.Height = this.Height; MyPictureBox_2.Location = new Point(0, 0); break; default: break; } } Invalidate(); }
private void IndexBrowseButton_Click(object sender, EventArgs e) { MyFolderBrowserDialog.ShowDialog(); IndexPath.Text = MyFolderBrowserDialog.SelectedPath; }