Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. private void toolStripRotateClockwise_Click(object sender, EventArgs e)
  2. {
  3. Image i = pictureBox1.Image;
  4. i.RotateFlip(RotateFlipType.Rotate90FlipNone);
  5. pictureBox1.Image = i;
  6. }
  7.  
  8. private void toolStripRotateCounterClockwise_Click(object sender, EventArgs e)
  9. {
  10. Image i = pictureBox1.Image;
  11. i.RotateFlip(RotateFlipType.Rotate270FlipNone);
  12. pictureBox1.Image = i;
  13. }
  14.  
  15. private void toolStripButtonPreviousImage_Click(object sender, EventArgs e)
  16. {
  17. if (counter > 0)
  18. {
  19. counter -= 1;
  20. }
  21. else
  22. {
  23. counter = fileNames.Length - 1;
  24. }
  25. pictureBox1.Load(fileNames[counter]); // Exception: ImageLocation must be set.
  26. }
  27.  
  28. private void toolStripButtonNextImage_Click(object sender, EventArgs e)
  29. {
  30. string directoryPath = Path.GetDirectoryName(openFileDialog1.FileName);
  31. DirectoryInfo di = new DirectoryInfo(directoryPath);
  32. FileInfo[] fi = di.GetFiles();
  33. fileNames = new string[fi.Length];
  34. int j = 0;
  35. foreach (FileInfo fi2 in fi)
  36. {
  37. if (fi2.Extension == ".jpg" || fi2.Extension == ".jpeg" || fi2.Extension == ".gif" || fi2.Extension ==
  38.  
  39. ".bmp" || fi2.Extension == ".png")
  40. {
  41. fileNames[j] = fi2.FullName;
  42. j++;
  43. }
  44. }
  45. if (counter < fileNames.Length - 1)
  46. {
  47. counter += 1;
  48. }
  49. else
  50. {
  51. counter = 0;
  52. }
  53. pictureBox1.Load(fileNames[counter]); // Exception: ImageLocation must be set.
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement