我想改变richedit中第n行的字体属性 该怎么做? 我除了知道该行的index 其它都不知道 RichEdit1.SelAttributes.Assign(Tfont{你自己定义}); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.SetLineFont(LineIndex: Integer; AFont: TFont);begin if LineIndex < 0 then LineIndex := 0 else if LineIndex > RichEdit1.Lines.Count - 1 then LineIndex := RichEdit1.Lines.Count - 1; RichEdit1.SelStart := SendMessage(RichEdit1.Handle, EM_LINEINDEX, LineIndex, 0); RichEdit1.SelLength := Length(RichEdit1.Lines[LineIndex]); RichEdit1.SelAttributes.Color := AFont.Color; RichEdit1.SelAttributes.Name := AFont.Name; RichEdit1.SelAttributes.Style := AFont.Style; RichEdit1.SelLength := 0; RichEdit1.SetFocus;end;procedure TForm1.Button2Click(Sender: TObject);var AFont: TFont;begin AFont := TFont.Create; try AFont.Name := '宋体'; AFont.Color := clRed; AFont.Style := AFont.Style + [fsBold]; SetLineFont(0, AFont); finally AFont.Free; end;end; 散分专贴三 BPL如何继承公共窗体? 给出字母, 如何得到汉字与汉字词组?? (拼音输入或五笔输入)(1000分相求)... 请问Delphi中怎么连接linux环境下的MYSQL数据库 報表rave 怎样截获开关光驱的系统消息 这个问题真的很难吗? 如何在Dbgrid中显示备注型字段内容 怎样用DBGrid连接多个表,不用SQL,在线等候。 如何在QuicRep控制一页中的行数(数据来自数据集),如何为每页中的行写入一个自增长序号? web问题2 有没有哪位高手可以帮我写一个判断日期合法性的函数? word 文档的提示-100分
begin
if LineIndex < 0 then
LineIndex := 0
else if LineIndex > RichEdit1.Lines.Count - 1 then
LineIndex := RichEdit1.Lines.Count - 1; RichEdit1.SelStart := SendMessage(RichEdit1.Handle, EM_LINEINDEX, LineIndex, 0);
RichEdit1.SelLength := Length(RichEdit1.Lines[LineIndex]);
RichEdit1.SelAttributes.Color := AFont.Color;
RichEdit1.SelAttributes.Name := AFont.Name;
RichEdit1.SelAttributes.Style := AFont.Style;
RichEdit1.SelLength := 0;
RichEdit1.SetFocus;
end;procedure TForm1.Button2Click(Sender: TObject);
var
AFont: TFont;
begin
AFont := TFont.Create;
try
AFont.Name := '宋体';
AFont.Color := clRed;
AFont.Style := AFont.Style + [fsBold];
SetLineFont(0, AFont);
finally
AFont.Free;
end;
end;