/// <summary> /// 对富文本框中的单词进行识别 /// </summary> private void shibie_rtb_dc(RichTextBox rtb) { //TextRange range = rtb.Selection; //TextPointer tp1 = range.Start; //TextPointer tp2 = range.End; for (int i = 0; i < dc_dt.Rows.Count; i++) { ScienceResearchDataSetNew.单词Row dc = (ScienceResearchDataSetNew.单词Row)dc_dt.Rows[i]; string dc_str = dc.单词; string fenlei_str = dc.分类; if (allRadioButton.IsChecked == true) { TextProcessClass.ChangeColor(ColorManager.color_mode_word, rtb, dc_str, "前景"); } else if (fenleiRadioButton.IsChecked == true && modeFenleiTextBox.Text == fenlei_str) { TextProcessClass.ChangeColor(ColorManager.color_mode_word, rtb, dc_str, "前景"); } else if (keywordRadioButton.IsChecked == true) { List <ScienceResearchDataSetNew.关键词Row> currentGjcAndSons = MainWindow.keywordTreeUserControl.currentGjcAndSons; foreach (ScienceResearchDataSetNew.单词_关键词Row dc_gjc in dc.Get单词_关键词Rows()) { if (currentGjcAndSons.Contains(dc_gjc.关键词Row)) { TextProcessClass.ChangeColor(ColorManager.color_mode_word, rtb, dc_str, "前景"); break; } } } } //range.Select(tp1, tp2); }
/// <summary> /// 对富文本框中的短语进行识别 /// </summary> private void shibie_rtb_dy(RichTextBox rtb) { for (int i = 0; i < dy_dt.Rows.Count; i++) { ScienceResearchDataSetNew.短语Row dy = (ScienceResearchDataSetNew.短语Row)dy_dt.Rows[i]; string dy_str = dy.短语; string fenlei_str = dy.分类; if (allRadioButton.IsChecked == true) { TextProcessClass.ChangeColor(ColorManager.color_mode_duanyu, rtb, dy_str, "背景"); } else if (fenleiRadioButton.IsChecked == true && modeFenleiTextBox.Text == fenlei_str) { TextProcessClass.ChangeColor(ColorManager.color_mode_duanyu, rtb, dy_str, "背景"); } else if (keywordRadioButton.IsChecked == true) { List <ScienceResearchDataSetNew.关键词Row> currentGjcAndSons = MainWindow.keywordTreeUserControl.currentGjcAndSons; foreach (ScienceResearchDataSetNew.短语_关键词Row dy_gjc in dy.Get短语_关键词Rows()) { if (currentGjcAndSons.Contains(dy_gjc.关键词Row)) { TextProcessClass.ChangeColor(ColorManager.color_mode_duanyu, rtb, dy_str, "背景"); break; } } } //TextProcessClass.XiaHuaXian(rtb, dy_str); } }
/// <summary> /// 取消标识 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnQingbiao_Click(object sender, RoutedEventArgs e) { RichTextBox rtb = textboxInkcavasUserControl_using.paragraphRichTextBox; TextProcessClass.SelectionChangeColor(rtb, ColorManager.color_zhengwen); }