问题
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;
.
来源:https://stackoverflow.com/questions/6978850/how-can-i-change-the-color-of-certain-characters-in-a-trichedit