CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: preserve color

  1. #1
    Join Date
    Jul 2009
    Posts
    37

    Question preserve color

    I have an richedit control on my dialog,
    wen I paste the copied formatted text in my clipboard on it, the text format is preserved,
    But if I put it in a CString variable, and paste it on the control, the colors go away, even when I use streamin/out to do that.
    Sig-na-tju-(r)

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: preserve color

    CString class has no idea what the color is. It only works with TCHAR arrays.
    Victor Nijegorodov

  3. #3
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: preserve color

    Quote Originally Posted by ThachQuanVy View Post
    I have an richedit control on my dialog,
    wen I paste the copied formatted text in my clipboard on it, the text format is preserved,
    But if I put it in a CString variable, and paste it on the control, the colors go away, even when I use streamin/out to do that.
    HOW do you put content from clipboard into your CString?
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  4. #4
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: preserve color

    Quote Originally Posted by VictorN View Post
    CString class has no idea what the color is. It only works with TCHAR arrays.
    But that array can contain rtf with color information in it.
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  5. #5
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: preserve color

    Quote Originally Posted by ThachQuanVy View Post
    ...But if I put it in a CString variable, and paste it on the control, the colors go away, even when I use streamin/out to do that.
    Be certain that your CString has the correct RTF codes in it. See the following for the current RTF format codes: "Rich Text Format (RTF) Specification, version 1.9.1" at http://www.microsoft.com/download/en...ng=en&id=10725

    And when using streamin, be certain that you use the SF_RTF flag, and not the SF_TEXT flag.

    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured