怎样将combobox的每一个item都有不同的字体,和颜色

解决方案 »

  1.   

    在DELPHI猛料里有介绍的,你去查查~
      

  2.   

    设置ComboBox1.Stylec:=sOwnerDrawFixed
    // in FormCreate:
    with ComboBox1.Items do 
    begin 
      Add(IntToStr(clRed)); 
      Add(IntToStr(clFuchsia)); 
      Add(IntToStr(clBlue)); 
      Add(IntToStr(clGreen));
      Add(IntToStr(clYellow));
    end;
    procedure TForm1.ComboBox1DrawItem(Control: TWinControl;
      Index : Integer; Rect: TRect; State: TOwnerDrawState);
    begin
      with Control as TComboBox,Canvas do 
      begin 
        // fill the rectangle first with white
        Brush.Color := clWhite; 
        FillRect(Rect); 
        // then reduce it and fill it with the color
        InflateRect(Rect,-2,-2); 
        Brush.Color := StrToInt(Items[Index]); 
        FillRect(Rect);
     end;
    end;
      

  3.   

    看看delphi6中的colorBox控件,很详细的。