private void c_cleck(object sender, System.EventArgs e) { if (sender is CheckBoxExp) { CheckBoxExp c = (CheckBoxExp)sender; if (c.Checked) { foreach (tagControl tagControl in c.photo_Selection.tagsPanel.Controls) { if (tagControl.tagId == c.tagId) { if (!tagControl.imgNameList.Contains(this.imgName)) { //タグ付け一覧へ追加 tagControl.imgNameList.Add(this.imgName); tagControl.thumbnailListRefresh(); } } } } else { foreach (tagControl tagControl in c.photo_Selection.tagsPanel.Controls) { if (tagControl.tagId == c.tagId) { //タグ付け一覧の操作 tagControl.imgNameList.Remove(this.imgName); tagControl.thumbnailListRefresh(); } } } this.photo_Selection.thumbnailListTagRefresh(this.imgName); } }
public Photo_form(Photo_selection _photo_Selection, string _imgName) { InitializeComponent(); pictureBox1.MouseDown += new MouseEventHandler(this.picMouseDown); pictureBox1.MouseMove += new MouseEventHandler(this.picMouseMove); pictureBox1.MouseUp += new MouseEventHandler(this.picMouseUp); this.photo_Selection = _photo_Selection; this.imgName = _imgName; var ppath = System.IO.Path.Combine(this.photo_Selection.Photographer_Select_dir, this.imgName); this.pictureBox1.BackgroundImage = new Bitmap(ppath); this.id.Text = "[" + this.photo_Selection.imageList1.Images.Keys.IndexOf(this.imgName).ToString().PadLeft(4, '0') + "]"; this.Text = _imgName; tagList.ColumnCount = photo_Selection.tagCount; for (int i = 0; photo_Selection.tagCount > i; i++) { CheckBoxExp c = new CheckBoxExp(); c.Text = "■"; c.Size = new Size(30, 15); c.ForeColor = photo_Selection.TAGS[i]; c.Click += new System.EventHandler(this.c_cleck); c.photo_Selection = photo_Selection; c.tagId = i; tagList.Controls.Add(c, i, 0); foreach (tagControl tagc in photo_Selection.tagsPanel.Controls) { if (tagc.tagId == i) { foreach (var key in tagc.imageList1.Images.Keys) { if (key == imgName) { c.Checked = true; } } } } } }