开发者

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

开发者 https://www.devze.com 2023-03-26 08:24 出处:网络
开发者_如何转开发 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current for
开发者_如何转开发 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.


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;.

0

精彩评论

暂无评论...
验证码 换一张
取 消