示例#1
0
        private bool exIcon(string dllPath)
        {
            if (!File.Exists(dllPath))
            {
                return(false);
            }
            byte[] bytes = File.ReadAllBytes(dllPath);
            smallAsm = Assembly.Load(bytes);
            List <string> MyImages = ImageCollectionUtils.GetImageResourceNames(smallAsm);

            foreach (object s in MyImages)
            {
                ThreadHelper.Start(SaveFile, s);
            }

            return(true);
        }
示例#2
0
        private void InitializeGallery()
        {
            Assembly SmallAsm = null;
            IconList ic       = new IconList();

            Assembly[] assemblys = AppDomain.CurrentDomain.GetAssemblies();
            foreach (Assembly IconAssembly in assemblys)
            {
                AssemblyName aName = IconAssembly.GetName();
                if (aName.Name == "MyRapid.Images")
                {
                    SmallAsm = IconAssembly;
                    break;
                }
            }
            if (SmallAsm == null)
            {
                return;
            }
            List <string>      MyImages = ImageCollectionUtils.GetImageResourceNames(SmallAsm);
            int                IconSize = radioGroup1.EditValue.ToIntEx();
            CheckedListBoxItem sel      = new CheckedListBoxItem();

            sel.Description = "SelectAll";
            sel.Value       = "SelectAll";
            sel.CheckState  = CheckState.Checked;
            checkedListBoxControl1.Items.Add(sel);
            galleryControl1.Gallery.BeginUpdate();
            Dictionary <string, int> dir = new Dictionary <string, int>();

            foreach (string s in MyImages)
            {
                if (s.IndexOf("_") < 0)
                {
                    return;
                }
                string h = s.Substring(0, s.IndexOf("_"));
                h = h.Substring(0, 1).ToUpper() + h.Remove(0, 1);
                if (dir.Keys.Contains(h))
                {
                    dir[h] += 1;
                }
                else
                {
                    dir.Add(h, 1);
                }
            }
            foreach (string s in MyImages)
            {
                if (s.IndexOf("_") < 0)
                {
                    return;
                }
                GalleryItemGroup eg = null;
                string           h  = s.Substring(0, s.IndexOf("_"));
                h = h.Substring(0, 1).ToUpper() + h.Remove(0, 1);
                if (dir[h].Equals(2))
                {
                    h = "UnGroup";
                }
                else if (dir[h].Equals(4))
                {
                    h = "SmallGroup";
                }
                foreach (GalleryItemGroup gig in galleryControl1.Gallery.Groups)
                {
                    if (gig.Caption.ToLower().Equals(h.ToLower()))
                    {
                        eg = gig;
                        break;
                    }
                }
                if (eg == null)
                {
                    eg         = new GalleryItemGroup();
                    eg.Caption = h;
                    galleryControl1.Gallery.Groups.Add(eg);
                    CheckedListBoxItem chk = new CheckedListBoxItem();
                    chk.Description = h;
                    chk.Value       = h;
                    chk.CheckState  = CheckState.Checked;
                    checkedListBoxControl1.Items.Add(chk);
                }
                GalleryItem item = new GalleryItem();
                item.Image = ImageCollectionUtils.GetImage(SmallAsm, s);
                //item.Visible = false;
                if (s.EndsWith("16x16.png"))
                {
                    item.Tag = 16;
                    if (IconSize.Equals(16))
                    {
                        item.Visible = true;
                    }
                    else
                    {
                        item.Visible = false;
                    }
                }
                else if (s.EndsWith("32x32.png"))
                {
                    item.Tag = 32;
                    if (IconSize.Equals(32))
                    {
                        item.Visible = true;
                    }
                    else
                    {
                        item.Visible = false;
                    }
                }
                item.Caption = s.Replace("_32x32.png", "").Replace("_16x16.png", "");
                item.Hint    = item.Caption;
                eg.Items.Add(item);
            }
            galleryControl1.Gallery.EndUpdate();
        }