<< Click to Display Table of Contents >> Navigation: Programming > Change text attributes in code > Implement an "Attribute Brush" |
It is easy to implement a feature to pick up the current attributes and apply them to the selected text. You only need a global string variable to store the attributes.
var a_string : string;
Read the contents of the "brush"
if WPRichText1.IsSelected then
a_string := WPRichText1.SelectedTextAttr.AGetWPSS
else a_string := WPRichText1.WritingAttr.AGetWPSS;
Apply the "brush"
if WPRichText1.IsSelected then
WPRichText1.SelectedTextAttr.AsetWPSS(a_string, true)
else WPRichText1.WritingAttr.ASetWPSS(a_string, true);
WPRichText1.ReformatAll(false, true);