I'm doing a Delphi 7 project where I have to let a user enter in a number (Layers going down) to build a Christmas tree, but I also need to display the output as *
(stars). I am having a problem editing a certain line of stars in the TRichEdit to make the color change randomly just like a real Christmas tree shines.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Formatting in rich edit controls works by first selecting text, then applying formatting to that selection.
Select the text with the SelStart
and SelLength
properties.
Apply formatting with the SelAttributes
property, for example SelAttributes.Color := clRed;
.