How can I change the color of certain characters in a TRichEdit? [closed]

…衆ロ難τιáo~ 提交于 2020-01-11 11:11:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!