void PlaceImage(string[] pics, string[] titles, bool[] markAsRed) { panel1.Controls.Clear(); c_imageListItems = null; c_imageListItems = new ImageListItem[pics.Count()]; for (int i = 0; i < pics.Count(); i++) { c_imageListItems[i] = new ImageListItem(); c_imageListItems[i].Top = i * (c_imageListItems[i].Height + 10); c_imageListItems[i].Left = 10; panel1.Controls.Add(c_imageListItems[i]); c_imageListItems[i].ImageLocation = pics[i]; c_imageListItems[i].Title = titles[i]; c_imageListItems[i].MarkAsRed = markAsRed[i]; c_imageListItems[i].c_PicBox.Click += c_picBoxes_Click; c_imageListItems[i].c_Title.GotFocus += c_Title_GotFocus; c_imageListItems[i].c_MoveUpButton.Click += c_MoveUpButton_Click; c_imageListItems[i].c_MoveDownButton.Click += c_MoveDownButton_Click; c_imageListItems[i].c_ChangePicButton.Click += c_ChangePic_Click; c_imageListItems[i].c_DeletePicButton.Click += c_DeletePic_Click; c_imageListItems[i].c_Title.KeyDown += C_Title_KeyDown; c_imageListItems[i].c_Title.KeyPress += C_Title_KeyPress; c_LargeImage.Image = null; } if (c_imageListItems.Count() > 0) { c_imageListItems[0].HideMoveUpButton(); c_imageListItems[c_imageListItems.Count() - 1].HideMoveDownButton(); } }
void SwitchImageListItem(ImageListItem a, ImageListItem b) { string tempTitle = a.Title; string tempImageLocation = a.ImageLocation; bool tempMarkAsRed = a.MarkAsRed; a.Title = b.Title; a.ImageLocation = b.ImageLocation; a.MarkAsRed = b.MarkAsRed; b.Title = tempTitle; b.ImageLocation = tempImageLocation; b.MarkAsRed = tempMarkAsRed; }