Esempio n. 1
0
        public void AppendImg(int size)
        {
            if (size < 8 || size > 256)
            {
                return;
            }

            Abc item;
            for (int i = 0; i < LbImg.Items.Count; i += 1)
            {
                item = LbImg.Items[i] as Abc;
                if (item == null)
                {
                    continue;
                }
                if (item.Format != PixelFormat.Format32bppArgb || item.Dim > size)
                {
                    continue;
                }
                if (item.Dim == size)
                {
                    LbImg.SelectedItem = item;
                    return;
                }

                item = new Abc();
                item.Decode(_BgImg, new Bitmap(size, size), PixelFormat.Format32bppArgb);
                LbImg.Items.Insert(i, item);
                LbImg.SelectedItem = item;
                return;
            }

            item = new Abc();
            item.Decode(_BgImg, new Bitmap(size, size), PixelFormat.Format32bppArgb);
            LbImg.Items.Add(item);
            LbImg.SelectedItem = item;
        }
Esempio n. 2
0
 private Abc DoSort(Abc item)
 {
     Abc temp;
     for (int i = 0; i < LbImg.Items.Count; i += 1)
     {
         temp = LbImg.Items[i] as Abc;
         if (temp == null)
         {
             continue;
         }
         if (temp.Format > item.Format)
         {
             continue;
         }
         if (temp.Format == item.Format)
         {
             if (temp.Dim > item.Dim)
             {
                 continue;
             }
             if (temp.Dim == item.Dim)
             {
                 return temp;
             }
             LbImg.Items.Insert(i, item);
             return item;
         }
         LbImg.Items.Insert(i, item);
         return item;
     }
     LbImg.Items.Add(item);
     return item;
 }