我正在用C#制作一个微型应用程序,它有一个文本框,3个按钮,每个按钮都是一个特定的坏词。如果单击它,它将在文本中找到该单词并将其删除。
按钮1命名为btn1,按钮2命名为btn2,按钮3命名为btn3。 我当时在考虑使用RichTextBoxFinds,但一开始就陷入困境。
private void btn1(object sender, EventArgs e)
{
Button btn1 = sender as Button;
string word1 = btn1.Text;
if (RichTextBox.Find(word1) = true)
{
RichTextBox.Delete(word1);
}
}