【问题标题】:Prevent selection of rich text box in Visual Basic 2010防止在 Visual Basic 2010 中选择富文本框
【发布时间】:2014-01-15 07:22:11
【问题描述】:

在我的 Visual Basic 程序中,我有一个富文本框,用于返回登录过程的成功或错误消息。这具有相关的颜色,也是一个只读文本框。

我的问题是您仍然可以突出显示框中的文本。我有以下属性集readonly = truedisabled = false。我无法禁用富文本框,因为它不允许使用文本颜色。

【问题讨论】:

    标签: visual-studio-2010 visual-studio textbox richtextbox highlight


    【解决方案1】:

    此代码可能对您有所帮助:将选择更改事件处理程序添加到富文本控件(C# 中的代码):

    private void richTextBox1_SelectionChanged(object sender, EventArgs e)
            {
                // Move the cursor to the end
                if (this.richTextBox1.SelectionStart != this.richTextBox1.TextLength)
                {
                    this.richTextBox1.SelectionStart = this.richTextBox1.TextLength;
                }
    
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-11
      • 1970-01-01
      • 2011-02-08
      • 1970-01-01
      • 1970-01-01
      • 2011-03-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多