/// <summary> /// Takes the file path specified and adds all pictures to the specified FlowLayoutPanel. /// </summary> /// <param name="panel">The FlowLayoutPanel to add the items to</param> /// <param name="file_to_use">The file that contains the image path to the pictures you want to use</param> private void populatePanel(FlowLayoutPanel panel, String file_to_use) { panel.Controls.Clear(); String[] pic_button_path = System.IO.File.ReadAllLines(file_to_use); Image_Button[] pic_button = new Image_Button[pic_button_path.Length]; for (int i = 0; i < pic_button.Length; i++) { pic_button[i] = new Image_Button(pic_button_path[i]); Control current = pic_button[i]; pic_button[i].Click += (s, e) => { selected_control = current; }; panel.Controls.Add(pic_button[i]); } }
private void populatePanel(String[] files) { possible_pics_panel.Controls.Clear(); String file_location = __settings.file_location; String[] pic_button_path = files; Image_Button[] pic_button = new Image_Button[pic_button_path.Length]; for (int i = 0; i < pic_button.Length; i++) { pic_button[i] = new Image_Button(pic_button_path[i]); Control current = pic_button[i]; pic_button[i].Click += (s, e) => { selected_control = current; }; possible_pics_panel.Controls.Add(pic_button[i]); } }