怎样在一个MEMO控件中设置两种或两种以上字体?
1、就象WORD那样,可以把选中的字的字体及大小随意设置。页其它的字体及大小不变。
2、对于MEMO中的字,对一些规定的字设置为一种字体,而其它的字设置为另一种字体?如把大写字母设置为正体,把小写字母设置为斜体。
1、就象WORD那样,可以把选中的字的字体及大小随意设置。页其它的字体及大小不变。
2、对于MEMO中的字,对一些规定的字设置为一种字体,而其它的字设置为另一种字体?如把大写字母设置为正体,把小写字母设置为斜体。
调试欢乐多
相信你能很容易看明白,并且很容易修改一下。
function TForm1.Search_And_Replace(RichEdit: TRichEdit; SearchText,
ReplaceText: string): Boolean;
var
startpos, Position, endpos: integer;
begin
startpos := 0;
with RichEdit do
begin
endpos := Length(RichEdit.Text);
Lines.BeginUpdate;
while FindText(SearchText, startpos, endpos, [stMatchCase])<>-1 do
begin
endpos := Length(RichEdit.Text) - startpos;
Position := FindText(SearchText, startpos, endpos, [stMatchCase]);
Inc(startpos, Length(SearchText));
SetFocus;
SelStart := Position;
SelLength := Length(SearchText);
richedit.clearselection;
SelText := ReplaceText;
end;
Lines.EndUpdate;
end;
end;