I make a form in which it would be possible to turn the images that are in tabconrol. It seems to me that the problem is in the PictureBox array.

Screen form

  using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using MetroFramework.Components; using MetroFramework.Forms; namespace Image { public partial class MainForm : MetroForm { Rectangle screenSize = System.Windows.Forms.Screen.PrimaryScreen.Bounds; int logoOffset; int index; PictureBox[] ArrayofIMG; Bitmap temp; public MainForm() { InitializeComponent(); ArrayofIMG = new PictureBox[TabCTRL.TabPages.Count]; for (int i = 0; i < (int)TabCTRL.TabPages.Count; i++) { PictureBox a = new PictureBox(); ArrayofIMG[i] = a; Controls.Add(a); } logoOffset = this.Width - logo.Width; this.StyleManager = msmMain; } private void MainForm_Resize(object sender, EventArgs e) { logo.Width = this.Width - logoOffset; } private void left_Click(object sender, EventArgs e) { index = TabCTRL.SelectedIndex; rotate("left",index); } private void right_Click(object sender, EventArgs e) { index = TabCTRL.SelectedIndex; rotate("right",index); } void rotate(string side, int index) { if (ArrayofIMG[index].Image != null) { temp = new Bitmap(ArrayofIMG[index].Image); ArrayofIMG[index].Image.Dispose(); switch (side) { case "left": temp.RotateFlip(RotateFlipType.Rotate270FlipNone); break; case "right": temp.RotateFlip(RotateFlipType.Rotate90FlipNone); break; } ArrayofIMG[index].Image = temp; temp = null; } } } } 
  • And what is the problem? - Dmitry D. Nov.
  • Accordingly, the coup does not work. ImageBox1 image names ... etc. When you declare an array, does it assign such elements to the elements? - Dmitry Ushkevich Nov.

0