コード例 #1
0
        void InitializeComponents()
        {
            //since this function is called multiple times, clear items just to be sure there is nothing in the object when you add to it
            this.Items.Clear();

            //runs for the lists length
            for (int i = 0; i < t.Count; i++)
            {
                //turns tags into DisplayList objects, very similar to the ColorPicker
                //(thats cause theyre doin the same thing)
                DisplayList item = new DisplayList(t[i].getName(), t[i].getColor());
                this.Items.Add(item);
            }

            this.ClearSelected();
            //keeping everything nice and aligned
            this.ItemHeight = 18;
        }
コード例 #2
0
        //when items are displayed
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            e.DrawBackground();

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

            //runs while there are DisplayList objects inside the TTTDisplayer
            if (e.Index >= 0 && e.Index < Items.Count)
            {
                //Draws the color square of the tag/tag type, as well as the name
                DisplayList item = (DisplayList)Items[e.Index];
                e.Graphics.DrawImage(item.temp, e.Bounds.Left, e.Bounds.Top);
                e.Graphics.DrawString(item.tName, f, new SolidBrush(e.ForeColor), e.Bounds.Left + item.temp.Width, e.Bounds.Top);
            }

            //scientists are still trying to figure out what this does
            base.OnDrawItem(e);
        }