Memo是不行!因为Memo就是NotePad,没看过notepad可以如此!
只能用TRichEdi,这个是编辑rtf文本的
procedure TForm1.Button1Click(Sender: TObject);
begin
        RichEdit1.SelAttributes.Color:=clRed;
        RichEdit1.SelAttributes.Size:=10;
        RichEdit1.SelAttributes.Name:='宋体';
end;
改变RichEdit1.SelAttributes的各种属性,就可以调整选中的字的各种属性1

解决方案 »

  1.   

    而且RichEdit中选中的字
    既可以是用鼠标拉中选的,也可以如下选中:
    procedure TForm1.Button2Click(Sender:TObject);
    begin
         RichEdit1.SelStart:=1;
         RichEdit1.SelLength:=10;
    end;
    这样时选中的是包括第一个字的10个字
      

  2.   

    Memo 是 Windows 标准组件,不行。
    可以用能实现这些功能的控件,或者用 RichEdit
      

  3.   

    谢谢ch81,你帮了我第二次,留下QQ或email好吗?
      

  4.   

    RichEdit1.SelStart,RichEdit1.SelLength是integer型的,怎样用确定鼠标随机选中的字呢?
    ch81,你的QQ我查找不到!
      

  5.   

    我用RICHTEXT写过超文本编辑器,我想和MEMO一样的,ch81(missile) 说的完全正确,如果还未搞定,我的EMAIL: [email protected]
      

  6.   

    SelText返回的是你选中的文字!
    SelStart是你选中的文字开头的第一个字母偏移的位置!
    SelLength是选中的文字的长度!
    后两个属性是可写的,即你可指定!
    qq我一直在线!
      

  7.   

    我是新手,在Combobox中设置了Combobox1.Items:=Screen.Fonts ,现在我想利用ComboBox中的字体在RichEdit中把选定的文本进行改变字体的操作而不影响其他的文本,怎么实现呢?是ComboBox的OnChange事件吗?我的代码如下(为什么有时会产生ECoverError的异常)
       procedure TSDIAppForm.ComboBox1Change(Sender: TObject);
    begin
       with (Sender as TComboBox) do
        if (SelLength <> 0) then
           begin
            RichEdit1.SelStart:=1;
            RichEdit1.SelLength:=Length(RichEdit1.selText);
            Richedit1.SelAttributes.Name:='Items.Strings[combobox1.ItemIndex]';
           end
        else
          StatusBar.SimpleText:='选择无效';
       end;   
      

  8.   

    procedure TForm1.ComboBox1Change
    begin
         if ComboBox1.Sellength<>0 then  
         begin
              RichEdit1.SelAttributes.Name:=ComboBox1.Items.Strings
              [combobox1.Itemindex];
         end;
    end;
    哪些内容试你以前选定的,你盖这个属性即可!
    除非你要自己在程序中计算选中,才要selstart,sellength