可以用
SelStart :=1 ;
Sellength := 9 ;
SelAttributes.Color := clRed;
satisfied ?

解决方案 »

  1.   

    在Richedit中可以按gdoyzy123()说的那样去做,改字体颜色、大小等均可以
      

  2.   

    //for Delphi6.0
    procedure TForm1.Button3Click(Sender: TObject);
    var
      Col: Integer;
    begin
      Col := 3;
      if Col >= RichEdit1.Lines.Count then Exit;
      RichEdit1.CaretPos := Point(0, Col);
      RichEdit1.SelLength := Length(RichEdit1.Lines[Col]);
      RichEdit1.SelAttributes.Color := clRed;
    end;
      

  3.   

    非常感谢,可是我还想问一个问题
    如果LISTBOX 中的ITEM项,能设置为不同的颜色吗????????????
      

  4.   

    procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
      Rect: TRect; State: TOwnerDrawState);
    begin
      with TListBox(Control).Canvas do begin
        FillRect(Rect);
        if Index = 2 then Font.Color := clRed;
        TextOut(Rect.Left, Rect.Top, TListBox(Control).Items[Index]);
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      ListBox1.Style := lbOwnerDrawFixed; //直接到窗体里设置
    end;