如何让ComboBox的某些Item字体Color变成灰色,当选中灰色的Item时ComboBox.Enable:=false。
或者有没这样的控件?
我查了些资料,说是ExpressQuantumGrid 控件组中的checkcombobox能达到这种效果,但我下了好几个版本的都装不了,而且还把delphi搞坏了。
如果checkcombobox真能达到这种效果的,能不能给个可以安装的版本。我用的是delphi6。

解决方案 »

  1.   

    还可以不统一设置啊?colorbox?
      

  2.   

    是ComboBox。
    没有人做过吗?
      

  3.   

    自画ComboBox来改变颜色:ComboBox1.Style := csOwnerDrawFixed;procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
      Rect: TRect; State: TOwnerDrawState);
    begin
      with TComboBox(Control).Canvas do
       begin
         if odSelected in State then
            begin
              Pen.Color := clBlue;
              Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom);
            end
          else
            begin
              Pen.Color := clWhite;
              Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom);
            end;
         if Index mod 2 = 0 then
            Font.Color := clBtnShadow
          else
            Font.Color := clBlack;
        TextOut(Rect.Left, Rect.Top, ComboBox1.Items[Index]);
      end;
    end;如果要用ExpressQuantumGrid的控件,去www.2ccc.com下载个傻瓜安装版试试。
      

  4.   

    补充一下,
    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
     if ComboBox1.Canvas.Font.Color= clBtnShadow then
        ComboBox1.Enabled:= false;
    end;
    嘿嘿