コード例 #1
0
ファイル: TagsForm.cs プロジェクト: Kaelthas0/VideoLibrary
        public TagsForm(MovieManager manager)
        {
            InitializeComponent();
            foreach (Selectable<Genre> genre in manager.getAllSearchTags())
            {
                TagItem box = new TagItem(genre);
                box.Text = genre.item.name;
                box.Checked = genre.selected;
                box.AutoCheck = false;
                if (box.genre.notThat)
                {
                    box.ForeColor = Color.Red;
                }
                else
                {
                    box.ForeColor = Color.Black;
                }
                box.MouseClick += (s, e) =>
                {
                    changed = true;
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        box.genre.notThat = !box.genre.notThat;
                        if (box.genre.notThat)
                        {
                            box.ForeColor = Color.Red;
                        }
                        else
                        {
                            box.ForeColor = Color.Black;
                        }

                    }
                    else
                    {
                        box.Checked = !box.Checked;
                        box.genre.selected = box.Checked;
                    }

                };

                flowLayoutPanel1.Controls.Add(box);
            }
        }