示例#1
0
        private void CondensedCheck_Click(object sender, EventArgs e)
        {
            CheckBox ck     = (CheckBox)sender;
            Button   button = ck.Parent.Parent.Parent.Controls[0] as Button;

            _lstItems[(int)ck.Tag].ImageItem.Checked = ck.Checked;
            if ((bool)(button.Tag))
            {
                if (ListStateChanged != null)
                {
                    ListStateChanged.Invoke(this, null);
                }
                return;
            }

            int index = 0;

            foreach (Control control in ck.Parent.Parent.Parent.Controls)
            {
                if (control.GetType() == typeof(Panel))
                {
                    ListItem item = Items[(int)control.Tag];
                    item.CheckState        = ck.CheckState;
                    item.ImageItem.Checked = ck.CheckState == CheckState.Checked;
                }
                index++;
            }
            ck.Parent.Parent.Parent.Tag = ck.CheckState;

            if (ListStateChanged != null)
            {
                ListStateChanged.Invoke(this, null);
            }
        }
示例#2
0
        private void ExpandedCheck_Click(object sender, EventArgs e)
        {
            CheckBox ck = (CheckBox)sender;

            _lstItems[(int)ck.Tag].ImageItem.Checked = ck.Checked;

            if (ListStateChanged != null)
            {
                ListStateChanged.Invoke(this, null);
            }
        }
示例#3
0
 public void AddImageCollection(ImageCollection imagecollection)
 {
     _lstImageCollection.Add(imagecollection);
     if (mode == ThumbMode.Condensed)
     {
         AddItemCondensed(imagecollection);
     }
     else
     {
         AddItemExpanded(imagecollection);
     }
     if (ListStateChanged != null)
     {
         ListStateChanged.Invoke(this, null);
     }
 }
示例#4
0
        public void RemoveItem(int index)
        {
            if (index == _selectedIndex)
            {
                _selectedIndex = -1;
                _selectedItem  = null;
            }
            if (mode == ThumbMode.Expanded)
            {
                DeleteItemExpanded(index);
            }
            else
            {
                DeleteItemCondensed(index);
            }

            if (ListStateChanged != null)
            {
                ListStateChanged.Invoke(this, null);
            }
        }
示例#5
0
        public void RemoveGroup(int index)
        {
            if (mode == ThumbMode.Expanded)
            {
                return;
            }

            GroupBox        grpBox     = this.Controls[index] as GroupBox;
            ImageCollection collection = _lstImageCollection[index];

            //Store Collapsed
            List <bool> bExpansionStatus = new List <bool>();

            foreach (Control cntrl in this.Controls)
            {
                bExpansionStatus.Add((bool)cntrl.Controls[0].Tag);
            }

            //GroupCheck status
            List <CheckState> bGroupCheck = new List <CheckState>();

            foreach (Control cntrl in this.Controls)
            {
                bGroupCheck.Add((CheckState)cntrl.Tag);
            }

            foreach (ListItem listItem in Items)
            {
                if (listItem.ImageItem.Parent == collection)
                {
                    listItem.Dispose();
                }
            }

            collection.Images.Clear();

            _lstImageCollection.RemoveAt(index);
            bExpansionStatus.RemoveAt(index);
            bGroupCheck.RemoveAt(index);
            collection = null;

            UpdateGroups();

            //Restore Collapsed
            for (int i = 0; i < bExpansionStatus.Count; i++)
            {
                if (bExpansionStatus[i])
                {
                    Expand(this.Controls[i] as GroupBox);
                }
                else
                {
                    Collapse(this.Controls[i] as GroupBox);
                }
            }

            for (int i = 0; i < bGroupCheck.Count; i++)
            {
                this.Controls[i].Tag = bGroupCheck[i];
            }

            if (ListStateChanged != null)
            {
                ListStateChanged.Invoke(this, null);
            }
        }