我的窗体上有个RichTextBox 控件,然后此控件的Text 属性是“您的好友给你发送了份文件,你是否接受,是?否?”然后我想要的效果是:“是”,“否”这2个字有下划线,就象支持超连接的效果样,所以打算加上这个LinkLabel控件,但是不知道怎么使用它才能达到那样的效果,在线等...

解决方案 »

  1.   

    在是或者否的地方直接加个LinkLabel,在rtbox中用空格替位
    设置LLabel的颜色和rtbox一般
    看上去就是你想要的效果
    如果你的控件可拖动
    同时设置两个控件的位置
      

  2.   

    TO : 楼上的
    在是或者否的地方直接加个LinkLabel,在rtbox中用空格替位???
    具体点怎么加LinkLabel?动态生成此控件,那此控件的位置又怎么定位在“是”,“否”这2个位置呢?
      

  3.   

    控制单击可能比较麻烦。效果控制如下:
    Font font = new Font("宋体", 12.0f);
    Font unlineFont = new Font("宋体", 12.0f, System.Drawing.FontStyle.Underline);
    this.richTextBox1.SelectionFont = font;
    this.richTextBox1.SelectedText = "您的好友给你发送了份文件,你是否接受,";
    this.richTextBox1.SelectionFont = unlineFont;
    this.richTextBox1.SelectionColor = Color.Blue;
    this.richTextBox1.SelectedText = "是";
    this.richTextBox1.SelectionFont = font;
    this.richTextBox1.SelectedText = "?";
    this.richTextBox1.SelectionFont = unlineFont;
    this.richTextBox1.SelectionColor = Color.Blue;
    this.richTextBox1.SelectedText = "否";
    this.richTextBox1.SelectionFont = font;
    this.richTextBox1.SelectedText = "?";
      

  4.   

    单击时通过richTextBox1.GetPositionFromCharIndex方法获取“是”,“否”的坐标
      

  5.   

    TO:752(凉开水) 
    我明白你的意思了 ,能不能用上LinkLabel呢,那样也许会简单点呢,关键问题可能是插入LinkLabel时,得不到具体的插入位置啊