如题
哪位大侠指点指点!!

解决方案 »

  1.   

    列表框COMbobox没有backimag属性.添加图片难道需要自己写方法吗?
      

  2.   

    无论是下拉还是选中,都需要重新绘制,也就是就combobox本身及图象,都是重新绘制上去的.
      

  3.   

    this.comboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
            {
                e.Graphics.DrawImage(this.imageList1.Images[e.Index], e.Bounds.X, e.Bounds.Y, 32, e.Bounds.Height);
                if (e.State == DrawItemState.Selected)
                {
                    Pen p = new Pen(Color.White);
                    Pen b=new Pen(SystemColors.Highlight);
                    e.Graphics.FillRectangle(b.Brush, e.Bounds.X + 32, e.Bounds.Y, e.Bounds.Width - 32, e.Bounds.Height);
                    e.Graphics.DrawString(this.comboBox1.Items[e.Index].ToString(), this.Font, p.Brush, e.Bounds.X + 35, e.Bounds.Y);
                          }
                else
                {
                   
                    Pen p = new Pen(Color.Black);
                    Pen b = new Pen(Color.White);
                    e.Graphics.FillRectangle(b.Brush, e.Bounds.X + 32, e.Bounds.Y, e.Bounds.Width - 32, e.Bounds.Height);
                    e.Graphics.DrawString(this.comboBox1.Items[e.Index].ToString(), this.Font, p.Brush, e.Bounds.X + 35, e.Bounds.Y);
                }
            }
      

  4.   

    首先在窗体中添加一个comboBox1和一个imageList(本例中带有三个图片)
    private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
            {
                Graphics g = e.Graphics;
                Rectangle r = e.Bounds;
                Size imageSize = imageList1.ImageSize;
           
                if (e.Index >= 0)
                {
                    Font fn = new Font("Tahoma", 10, FontStyle.Bold);
                    string s = (string)comboBox1.Items[e.Index];
                    StringFormat sf = new StringFormat();
                    sf.Alignment = StringAlignment.Near;
                    if (e.State == (DrawItemState.NoAccelerator | DrawItemState.NoFocusRect))
                    {
                        //画条目背景 
                        e.Graphics.FillRectangle(new SolidBrush(Color.Red), r);
                        //绘制图像 
                        imageList1.Draw(e.Graphics, r.Left, r.Top, e.Index);
                        //显示字符串 
                        e.Graphics.DrawString(s, fn, new SolidBrush(Color.Black), r.Left + imageSize.Width, r.Top);
                        //显示取得焦点时的虚线框 
                        e.DrawFocusRectangle();
                    }
                    else
                    {
                        e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue), r);
                        imageList1.Draw(e.Graphics, r.Left, r.Top, e.Index);
                        e.Graphics.DrawString(s, fn, new SolidBrush(Color.Black), r.Left + imageSize.Width, r.Top);
                        e.DrawFocusRectangle();
                    }
                }        }        private void Form1_Load(object sender, EventArgs e)
            {
                comboBox1.DrawMode = DrawMode.OwnerDrawFixed;
                comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
                comboBox1.Items.Add("小车");
                comboBox1.Items.Add("视频");
                comboBox1.Items.Add("信号灯"); 
     
            }
      

  5.   

    首先在窗体中添加一个comboBox1和一个imageList(本例中带有三个图片) 
    private void comboBox1_DrawItem(object sender, DrawItemEventArgs e) 
            { 
                Graphics g = e.Graphics; 
                Rectangle r = e.Bounds; 
                Size imageSize = imageList1.ImageSize; 
          
                if (e.Index >= 0) 
                { 
                    Font fn = new Font("Tahoma", 10, FontStyle.Bold); 
                    string s = (string)comboBox1.Items[e.Index]; 
                    StringFormat sf = new StringFormat(); 
                    sf.Alignment = StringAlignment.Near; 
                    if (e.State == (DrawItemState.NoAccelerator ¦ DrawItemState.NoFocusRect)) 
                    { 
                        //画条目背景 
                        e.Graphics.FillRectangle(new SolidBrush(Color.Red), r); 
                        //绘制图像 
                        imageList1.Draw(e.Graphics, r.Left, r.Top, e.Index); 
                        //显示字符串 
                        e.Graphics.DrawString(s, fn, new SolidBrush(Color.Black), r.Left + imageSize.Width, r.Top); 
                        //显示取得焦点时的虚线框 
                        e.DrawFocusRectangle(); 
                    } 
                    else 
                    { 
                        e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue), r); 
                        imageList1.Draw(e.Graphics, r.Left, r.Top, e.Index); 
                        e.Graphics.DrawString(s, fn, new SolidBrush(Color.Black), r.Left + imageSize.Width, r.Top); 
                        e.DrawFocusRectangle(); 
                    } 
                }         }         private void Form1_Load(object sender, EventArgs e) 
            { 
                comboBox1.DrawMode = DrawMode.OwnerDrawFixed; 
                comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; 
                comboBox1.Items.Add("小车"); 
                comboBox1.Items.Add("视频"); 
                comboBox1.Items.Add("信号灯");         } 
      

  6.   

    没有吧 vs2005开始combox本身就支持显示图片的