如何控制richedit的行距和设置字体
1个回答
推荐于2016-12-04 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517193
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
uses RichEdit;
procedure RichEditLineSpacing( //设置编辑框的行距
mRichEdit: TRichEdit; //Rich编辑框
mLineSpacingRule: Byte //行距 0~2
);
var
vParaFormat2: ParaFormat2;
begin
if not Assigned(mRichEdit) then Exit;
FillChar(vParaFormat2, SizeOf(vParaFormat2), 0);
vParaFormat2.cbSize := SizeOf(ParaFormat2);
vParaFormat2.dwMask := PFM_LINESPACING;
vParaFormat2.bLineSpacingRule := mLineSpacingRule;
vParaFormat2.dyLineSpacing := Ord(True);
mRichEdit.Perform(EM_SETPARAFORMAT, 0, Longint(@vParaFormat2));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RichEdit1.SelectAll;
RichEditLineSpacing(RichEdit1, 0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
RichEdit1.SelectAll;
RichEditLineSpacing(RichEdit1, 1);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
RichEdit1.SelectAll;
RichEditLineSpacing(RichEdit1, 2);
end;
procedure RichEditLineSpacing( //设置编辑框的行距
mRichEdit: TRichEdit; //Rich编辑框
mLineSpacingRule: Byte //行距 0~2
);
var
vParaFormat2: ParaFormat2;
begin
if not Assigned(mRichEdit) then Exit;
FillChar(vParaFormat2, SizeOf(vParaFormat2), 0);
vParaFormat2.cbSize := SizeOf(ParaFormat2);
vParaFormat2.dwMask := PFM_LINESPACING;
vParaFormat2.bLineSpacingRule := mLineSpacingRule;
vParaFormat2.dyLineSpacing := Ord(True);
mRichEdit.Perform(EM_SETPARAFORMAT, 0, Longint(@vParaFormat2));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RichEdit1.SelectAll;
RichEditLineSpacing(RichEdit1, 0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
RichEdit1.SelectAll;
RichEditLineSpacing(RichEdit1, 1);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
RichEdit1.SelectAll;
RichEditLineSpacing(RichEdit1, 2);
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询