示例#1
0
 private int DoInsertItem(int index, ImageListBoxItem item)
 {
     item.imageList = this.imageList;
     item.itemIndex = index;
     base.Items.Insert(index, item);
     return(index);
 }
示例#2
0
        /// <summary>
        /// Overrides parent OnDrawItem method to perform custom painting
        /// </summary>
        /// <param name="pe"></param>
        protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs pe)
        {
            pe.DrawBackground();
            pe.DrawFocusRectangle();
            Rectangle bounds = pe.Bounds;

            // Check whether the index is valid
            if (pe.Index >= 0 && pe.Index < base.Items.Count)
            {
                ImageListBoxItem item = (ImageListBoxItem)base.Items[pe.Index];
                int iOffset           = 0;
                // If the image list is present and the image index is set, draw the image
                if (this.imageList != null)
                {
                    if (item.ImageIndex != -1 && item.ImageIndex < this.imageList.Images.Count)
                    {
                        this.imageList.Draw(pe.Graphics, bounds.Left, bounds.Top, item.ImageIndex);
                    }
                    iOffset += this.imageList.ImageSize.Width;
                }
                // Draw item text
                pe.Graphics.DrawString(item.Text, pe.Font, new SolidBrush(pe.ForeColor),
                                       bounds.Left + iOffset, bounds.Top);
            }
            base.OnDrawItem(pe);
        }
示例#3
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(InstanceDescriptor))
     {
         ConstructorInfo ci = typeof(ImageListBoxItem).GetConstructor(new Type[] {
             typeof(string),
             typeof(int)
         });
         ImageListBoxItem item = (ImageListBoxItem)value;
         return(new InstanceDescriptor(ci, new object[] { item.Text, item.ImageIndex }, true));
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
示例#4
0
        public void addChangeLog(ImageListBox listBox, Changelog changelog, 
                String updateName, String baseType, int imageIndex)
        {
            Logger.log(Logger.TYPE.DEBUG, "Add changelog.");

            String text = "[" + changelog.getVersion() + baseType + "] " + updateName;
            ImageListBoxItem item = new ImageListBoxItem(text, imageIndex);

            listBox.Items.Add(item);
        }
示例#5
0
 private void DoSetElement(int index, ImageListBoxItem value)
 {
     base.Items[index] = value;
 }
示例#6
0
 public int Add(ImageListBoxItem item)
 {
     return(owner.DoInsertItem(this.Count, item));
 }
示例#7
0
 public void Insert(int index, ImageListBoxItem item)
 {
     owner.DoInsertItem(index, item);
 }
示例#8
0
 public void Remove(ImageListBoxItem item)
 {
     throw new NotSupportedException();
 }
示例#9
0
 public void Remove(ImageListBoxItem item)
 {
     throw new NotSupportedException();
 }
示例#10
0
 public void Insert(int index, ImageListBoxItem item)
 {
     owner.DoInsertItem(index, item);
 }
示例#11
0
 public void AddRange(ImageListBoxItem[] items)
 {
     for(IEnumerator e = items.GetEnumerator(); e.MoveNext();)
         owner.DoInsertItem(this.Count, (ImageListBoxItem)e.Current);
 }
示例#12
0
 public int Add(ImageListBoxItem item)
 {
     return owner.DoInsertItem(this.Count, item);
 }
示例#13
0
 private void DoSetElement(int index, ImageListBoxItem value)
 {
     base.Items[index] = value;
 }
示例#14
0
 private int DoInsertItem(int index, ImageListBoxItem item)
 {
     item.imageList = this.imageList;
     item.itemIndex = index;
     base.Items.Insert(index, item);
     return index;
 }