0

I want to display an RTF file with some links in it; the links have the RTF encoding:

{\field{\*\fldinst{HYPERLINK "http://a-link.com" }}{\fldrslt{\cf1\ul here is a link}}}

In WordPad and Word, this displays as "here is a link", underlined, as expected.

When I load the RTF into a rich edit control (RichEdit20A), it displays:

here is a link <http://a-link.com>

Is there any way to get the rich edit control to stop displaying the angle-bracketed URL after the friendly name?

Thanks!

Monsieur
  • 9
  • 2

1 Answers1

1

Use RichTextBox v5. The default in Visual Studio is v4. It fixes this problem among others.

public class RichText50W : RichTextBox
{
    [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
    static extern IntPtr LoadLibrary(string lpFileName);
    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams prams = base.CreateParams;
            if (LoadLibrary("msftedit.dll") != IntPtr.Zero)
            {
                prams.ClassName = "RICHEDIT50W";
            }
            return prams;
        }
    }
}
Jerry
  • 4,258
  • 3
  • 31
  • 58