| CPCharAttr property |
Applies to
TWPCustomRtfEdit
Declaration
property CPCharAttr: Cardinal;
Description
This property retrieves the number of the character attribute at the cursor position. Usually you cannot do much with this number since it is used internally by the RTF engine, but it 2 cases it makes sense to read this property: a) if you want to detect if a character has no character attribute you can compare the value with 0: This example assigns a font and a color to the text which does not have a character attribute.
WPRichText1.CPPosition := 0;
repeat
if (WPRichText1.CPCharAttr and cafsALL)=0 then
begin
WPRichText1.CPAttr.BeginUpdate;
WPRichText1.CPAttr.FontName := 'Courier New';
WPRichText1.CPAttr.Color := WPRichText1.GetColorNr(clRed);
WPRichText1.CPAttr.EndUpdate;
end;
until not WPRichText1.CPMoveNext;
WPRichText1.Refresh; |
Category
CP-Props
|
Copyright (C) by WP |