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
只能用TRichEdi,这个是编辑rtf文本的
procedure TForm1.Button1Click(Sender: TObject);
begin
RichEdit1.SelAttributes.Color:=clRed;
RichEdit1.SelAttributes.Size:=10;
RichEdit1.SelAttributes.Name:='宋体';
end;
改变RichEdit1.SelAttributes的各种属性,就可以调整选中的字的各种属性1
既可以是用鼠标拉中选的,也可以如下选中:
procedure TForm1.Button2Click(Sender:TObject);
begin
RichEdit1.SelStart:=1;
RichEdit1.SelLength:=10;
end;
这样时选中的是包括第一个字的10个字
可以用能实现这些功能的控件,或者用 RichEdit
ch81,你的QQ我查找不到!
SelStart是你选中的文字开头的第一个字母偏移的位置!
SelLength是选中的文字的长度!
后两个属性是可写的,即你可指定!
qq我一直在线!
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;
begin
if ComboBox1.Sellength<>0 then
begin
RichEdit1.SelAttributes.Name:=ComboBox1.Items.Strings
[combobox1.Itemindex];
end;
end;
哪些内容试你以前选定的,你盖这个属性即可!
除非你要自己在程序中计算选中,才要selstart,sellength