当前位置: 代码迷 >> .NET组件控件 >> richtextbox如何实现超链接
  详细解决方案

richtextbox如何实现超链接

热度:8909   发布时间:2013-02-25 00:00:00.0
richtextbox怎么实现超链接
richtextbox怎么把特定的中文解析成为超链接 [你好],把[]里的值你好做成超链接
------解决方案--------------------------------------------------------
关注中...
------解决方案--------------------------------------------------------
using System;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Data;
using System.Text;
using System.Collections;
using System.Runtime.InteropServices;
namespace richtextboxshree
{
    public class richtextboxshree : System.Windows.Forms.RichTextBox
    {
        #region   Interop-Defines
        [StructLayout(LayoutKind.Sequential)]
        private struct CHARFORMAT2_STRUCT
        {
            public UInt32 cbSize;
            public UInt32 dwMask;
            public UInt32 dwEffects;
            public Int32 yHeight;
            public Int32 yOffset;
            public Int32 crTextColor;
            public byte bCharSet;
            public byte bPitchAndFamily;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
            public char[] szFaceName;
            public UInt16 wWeight;
            public UInt16 sSpacing;
            public int crBackColor;   //   Color.ToArgb()   ->   int   
            public int lcid;
            public int dwReserved;
            public Int16 sStyle;
            public Int16 wKerning;
            public byte bUnderlineType;
            public byte bAnimation;
            public byte bRevAuthor;
            public byte bReserved1;
        }

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);

        private const int WM_USER = 0x0400;