示例#1
0
        void changeOperatorColor()
        {
            Analyser analyser = new Analyser();

            string[] lines = textUrdu.Text.Split('\n');
            foreach (var line in lines)
            {
                string[] words = analyser.analyse(line).Split();
                foreach (var word in words)
                {
                    if (Operators.find(word.Trim()) != "null")
                    {
                        if (textUrdu.Text.Contains(word))
                        {
                            textUrdu.Select(textUrdu.Text.IndexOf(word), (word.Length));
                            textUrdu.SelectionColor = Color.Red;
                            textUrdu.DeselectAll();
                        }
                    }
                    else if (KeyWords.find(word.Trim()) == "null")
                    {
                        textUrdu.Select(textUrdu.Text.IndexOf(word), (word.Length));
                        textUrdu.SelectionColor = Color.Black;
                        textUrdu.DeselectAll();
                    }
                }
            }
        }