在richtextbox中为错误的单词加下划线

时间:2014-02-17 20:40:25

标签: c# winforms richtextbox underline

我的项目遇到了很多麻烦,我到处寻找解决方案,但我找不到任何可以帮助我的东西,或者至少我是那么不知道怎么样的菜鸟将代码粘贴到我的案例中(我刚开始学习c#)。这是我代码的一部分:

    private void sottolinea_errori_Click(object sender, EventArgs e)
    {
        string line;
        string[] linea = linea = TextBox_stampa_contenuto.Lines;
        if (TextBox_stampa_contenuto.Text != "")
        {
            foreach (string k in linea)
            {
                string[] parole = k.Split(new Char[] { ' ', ',', '.', ':', '\t' });
                foreach (string s in parole)
                {
                    Regex rgx = new Regex(@"\d");
                    if (!rgx.IsMatch(s))
                    {
                        if (s.Trim() != "")
                        {
                            s.Trim();
                            string path = @"280000parole.txt";
                            bool esito = true;
                            StreamReader file = new StreamReader(path);
                            while ((line = file.ReadLine()) != null && esito == true)
                                if (string.Compare(line, s) == 0)
                                    esito = false;
                            file.Close();
                            if (esito)
                            {
                                //code to underline
                            }
                        }
                    }
                }
            }
        }
    }

它的作用是:它检查我用作字典的txt文件中是否存在每个单词。我想强调该txt文件中不存在的单词。有办法吗? 谢谢!

0 个答案:

没有答案