Delphi 如何在RichEdit中使单行加粗?
如何在RichEdit中使一个特定的行变为粗体?在rich edit控件中进行格式化如下:Delphi 如何在RichEdit中使单行加粗?,delphi,delphi-6,richedit,Delphi,Delphi 6,Richedit,如何在RichEdit中使一个特定的行变为粗体?在rich edit控件中进行格式化如下: RichEdit1.SelStart := SelectionStart; RichEdit1.SelLength := SelectionLength; RichEdit1.SelAttributes.Style := RichEdit1.SelAttributes.Style + [fsBold]; 选择要应用格式的文本 将该格式应用于所选内容 事情是这样的: RichEdit1.SelStart
RichEdit1.SelStart := SelectionStart;
RichEdit1.SelLength := SelectionLength;
RichEdit1.SelAttributes.Style := RichEdit1.SelAttributes.Style + [fsBold];
RichEdit1.SelStart := SelectionStart;
RichEdit1.SelLength := SelectionLength;
RichEdit1.SelAttributes.Style := RichEdit1.SelAttributes.Style + [fsBold];
当然,您必须确定使用什么来代替
SelectionStart
和SelectionLength
。归根结底,这取决于你是如何管理文本的,我认为问题中没有足够的信息来给你一个关于这个主题的明确答案。设置seldattributes
并写一行新的内容。或者,选择已经存在的行并设置seltributes
。