Set RichEdit font parameters

Posted in Fonts

SelAttributes.Style method of RichEditComponent. You may set bold, italic, underline, strikeout style and other parameters of font in RichEdit. And don't forget to return focus to RichEdit component.

procedure TForm1.Button1Click(Sender: TObject);
begin
  if fsBold in RichEdit1.SelAttributes.Style then
    RichEdit1.SelAttributes.Style:=
      RichEdit1.SelAttributes.Style-[fsBold]
  else
    RichEdit1.SelAttributes.Style:=
      RichEdit1.SelAttributes.Style+[fsBold];
  RichEdit1.SetFocus;
end;