function CurrText: TTextAttributes; begin if RichEdit1.SelLength > 0 then Result := RichEdit1.SelAttributes else Result := RichEdit1.DefAttributes; end; //字体******************** CurrText.Name := 字体名称 //对齐 RichEdit1.Paragraph.Alignment := taLeftJustify; //左 RichEdit1.Paragraph.Alignment := taCenter; //中 RichEdit1.Paragraph.Alignment := taRightJustify; //右
谢谢大家,我最后看Delphi的帮助了! procedure TForm1.Button1Click(Sender: TObject);begin with RichEdit1.SelAttributes do begin Color := clRed; Height := Height + 5; end; RichEdit1.Lines.Add('This line of text will be red.'); end;procedure TForm1.Button2Click(Sender: TObject); begin RichEdit1.DefAttributes.Color := clBlue; RichEdit1.DefAttributes.Style := [fsBold, fsItalic]; end;
B:我的都让我老伴给用了
begin
if RichEdit1.SelLength > 0 then Result := RichEdit1.SelAttributes
else Result := RichEdit1.DefAttributes;
end;
//字体********************
CurrText.Name := 字体名称
//对齐
RichEdit1.Paragraph.Alignment := taLeftJustify; //左
RichEdit1.Paragraph.Alignment := taCenter; //中
RichEdit1.Paragraph.Alignment := taRightJustify; //右
procedure TForm1.Button1Click(Sender: TObject);begin
with RichEdit1.SelAttributes do
begin
Color := clRed;
Height := Height + 5;
end;
RichEdit1.Lines.Add('This line of text will be red.');
end;procedure TForm1.Button2Click(Sender: TObject);
begin
RichEdit1.DefAttributes.Color := clBlue;
RichEdit1.DefAttributes.Style := [fsBold, fsItalic];
end;