コード例 #1
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            e.DrawBackground();

            Font f = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));

            if (e.Index >= 0 && e.Index < Items.Count)
            {
                FilterListItem item = (FilterListItem)Items[e.Index];
                e.Graphics.DrawImage(item.bg, e.Bounds.Left, e.Bounds.Top);
                //e.Graphics.DrawImage(item.space, e.Bounds.Left, e.Bounds.Bottom + 10);
                e.Graphics.DrawImage(item.temp, e.Bounds.Left, e.Bounds.Top);
                e.Graphics.DrawImage(item.xButton, e.Bounds.Right - item.xButton.Width, e.Bounds.Top);
                e.Graphics.DrawString(item.name, f, new SolidBrush(e.ForeColor), e.Bounds.Left + item.temp.Width, e.Bounds.Top);
                e.Graphics.DrawString(item.includeToString(), f, new SolidBrush(e.ForeColor), e.Bounds.Left, e.Bounds.Bottom - item.space.Height - 25);
            }

            //scientists are still trying to figure out what this does
            base.OnDrawItem(e);
        }
コード例 #2
0
        void InitializeComponents()
        {
            this.Items.Clear();
            this.Size = new Size(WIDTH, HEIGHT);

            for (int i = 0; i < f.Count; i++)
            {
                FilterListItem item = new FilterListItem(f[i].getName(), f[i].getColor(), f[i].getInclude(), f[i].getType(), WIDTH);
                this.Items.Add(item);
            }

            this.ClearSelected();
            this.ItemHeight = 60;

            this.SelectedIndexChanged += new EventHandler(newListItem_Select);
            void newListItem_Select(object sender, EventArgs e)
            {
                if (this.SelectedIndex != -1)
                {
                    f.RemoveAt(this.SelectedIndex);
                    this.Items.Remove(this.SelectedItem);
                }
            }
        }