RichTextBox selection bug when pressing control key

梦想的初衷 提交于 2019-12-08 19:41:57

问题


I have a very strange bug with text selection in RichTextBox :

I create the following simple form :

public partial class Form1 : Form
{
    public Form1()
{
    InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        richTextBox1.Text = "Tempore quo primis auspiciis in mundanum fulgorem surgeret victura dum erunt homines Roma, ut augeretur sublimibus incrementis, foedere pacis aeternae Virtus convenit atque Fortuna plerumque dissidentes, quarum si altera defuisset, ad perfectam non venerat summitatem.";
    }
}

When launching the app I can select the text in the RichTextBox until I press the control key.

The RichTextBox is then no longer selectable until I click several times outside the application.

I hear about silly bug with AutoWordSelection but I tried the trick without success.

I'm using Framework .Net v4 on Windows 8.

Does anyone have an idea about it?


回答1:


Can you see what is selected when the control button is clicked. (Maybe another application that is running?)




回答2:


Mybe put the text outside the application. works good for me

    private void CleaningManual_Load(object sender, EventArgs e)
    {
        RichTB.LoadFile(@"C:\awTextFiles\CleaningManual.rtf");
    }



回答3:


Add this to your form load event.

RichTextBox1.AutoWordSelection = False

this is reputed to be a 'will not fix' feature so you have to deactivate behaviour I'm afraid



来源:https://stackoverflow.com/questions/19256004/richtextbox-selection-bug-when-pressing-control-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!