如上。

解决方案 »

  1.   

    首先在你的ComboBox的Item里要包含图片信息或能表示成图片.
    然后重写如下的两个方法:
    OnMeasureItem
    OnDrawItem
    或者添加ComboBox的这两个事件并处理:
    MeasureItem
    DrawItem
      

  2.   

    private void comboBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
    {//绘制列表项 ComboBox MyCombox=(ComboBox)sender;
    if(e.Index==-1)
    return;
    if(sender==null)
    return;
    SolidBrush MyBrush=new SolidBrush(Color.Red);
    Graphics g=e.Graphics;
    Rectangle MyRect=e.Bounds;
    MyRect.Offset(2,2);
    MyRect.Width=50;
    MyRect.Height-=4;
    MyRect.Offset(1,1);
    MyRect.Width-=2;
    MyRect.Height-=2;
                               //绘制图片
    g.DrawImage(Image.FromFile(@""),MyRect);
    //绘制选定颜色的名称
    g.DrawString(MyBrush.Color.Name.ToString(),Font,new SolidBrush(e.ForeColor),e.Bounds.X+60,e.Bounds.Y+1);
    }
      

  3.   

    private void comboBox1_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e)
    {//设置列表项宽
    e.ItemHeight=this.comboBox1.ItemHeight-2;
    }
      

  4.   

    在drawitem方法里面还要加:
    //如果已经进行选择,则绘制正确的背景颜色和聚集框
    e.DrawBackground();
    e.DrawFocusRectangle();
      

  5.   

    private void cmbImage_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
    {
    ArrayList fontArray = new ArrayList() ; 
    fontArray.Add(new Font("Ariel" , 8,FontStyle.Bold));
    fontArray.Add(new Font("Courier",8,FontStyle.Italic));
    fontArray.Add(new Font("Veranda",8,FontStyle.Bold)); Graphics g = e.Graphics ; 
    Rectangle r = e.Bounds ; 
    Size imageSize = ImageList1.ImageSize; 
    Font fn = null ; 
    if ( e.Index >= 0 ) 

    fn = (Font)fontArray[0]; 
    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); 
    comboBox1.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(); 


    }能看看我上面的這段代碼不,老是出錯:指定的论据是超出有效值的范围。参数名:‘3’不是一个有效值为‘索引’。我測試了一下,e.Index的值為-1
      

  6.   

    把你的if ( e.Index >= 0 ) 
    改成下面
    if(e.Index==-1)
    return;
    if(sender==null)
    return;