trichview.com

trichview.support




Pasting RTF text color issue


Return to index


Author

Message

DavidRM

Posted: 01/03/2004 23:21:14


While paying attention to the TRVStyle.TextStyles list, I noticed that when

I would paste RTF int TRichViewEdit I was getting a redundant font style.

The redundancy was caused by the default text style having color "clWindowText",

while what was passed in had color "clBlack". On my system, those are the

same. While this won't always be the case, I prefer not to have the redundant

font style if it can be avoided.


I solved the problem by changing TRVRTFReaderProperties.FindStyleNo slightly,

adding calls to ColorToRGB() in the font style comparison logic:


      if (AnsiLowerCase(FontStyle.FontName)=FN) and

         ...

         (ColorToRGB(FontStyle.Color)=ColorToRGB(Color)) and // drm - added

ColorToRGB()

         (ColorToRGB(FontStyle.BackColor)=ColorToRGB(BackColor)) and // drm

- added ColorToRGB()

         ...


If the two colors are then the same, the existing font style will be selected.

If not, a new one is created as before.


Just thought I'd pass this along...and request that (barring unforeseen,

unknown issues), this change be made to the source.


Thanks.


-David

http://www.davidrm.com





Powered by ABC Amber Outlook Express Converter