Ejemplo n.º 1
0
 public void UseSubset(Type[] types)
 {
     if (types != null)
     {
         int i = 0;
         while (i < this.Items.Count)
         {
             bool             b = true;
             DrawItemListItem t = this.Items[i] as DrawItemListItem;
             if (t != null)
             {
                 for (int j = 0; j < types.Length; j++)
                 {
                     if (t.ItemType.Equals(types[j]))
                     {
                         b = false;
                         break;
                     }
                 }
             }
             if (b)
             {
                 this.Items.RemoveAt(i);
             }
             else
             {
                 i++;
             }
         }
     }
 }
Ejemplo n.º 2
0
 protected override void OnDrawItem(DrawItemEventArgs e)
 {
     if (e.Index >= 0 && e.Index < Items.Count)
     {
         System.Drawing.Rectangle rc = e.Bounds;
         rc.X = e.Bounds.Left + 2;
         rc.Y = e.Bounds.Top + 2;
         DrawItemListItem tp  = (DrawItemListItem)Items[e.Index];
         Image            img = tp.ItemImage;
         if ((e.State & DrawItemState.Selected) != 0)
         {
             //fill background
             e.Graphics.FillRectangle(m_brushBKSelected, e.Bounds);
             //draw image
             e.Graphics.DrawImage(img, rc.Left, rc.Top);
             //write name
             rc.X = rc.Left + img.Width + 2;
             e.Graphics.DrawString(tp.ToString(), m_font, m_brushWhite, rc);
         }
         else
         {
             //fill name background
             e.Graphics.FillRectangle(m_brushWhite, e.Bounds);
             //draw image
             e.Graphics.DrawImage(img, rc.Left, rc.Top);
             //write name
             rc.X = rc.Left + img.Width + 2;
             e.Graphics.DrawString(tp.ToString(), m_font, m_brushBlack, rc);
         }
         //draw name box
         e.Graphics.DrawRectangle(m_penLine, e.Bounds);
     }
 }