关于记事本的问题

qqlxx 2006-10-21 08:39:02
记事本编辑菜单项的查找用C#怎么实现啊,大虾们,帮帮忙啊!界面做好了,不知道该怎么实现啊!
...全文
89 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jointan 2006-10-22
  • 打赏
  • 举报
回复
你是要和记事本彻底一模一样的?
现在代码的效果是可以实际查找的基本功能的,最多再扩展一下,变成向上查找和向下查找,并添加区分大小写功能
不会是根本找不到,或查找不正确吧
qqlxx 2006-10-22
  • 打赏
  • 举报
回复
大哥,还是不行啊!
jointan 2006-10-21
  • 打赏
  • 举报
回复
修正一下:
int s = this.textBox1.SelectionStart;
if (this.textBox1.SelectedText == "要查找的内容")
{
s++;
}
int result = this.textBox1.Text.IndexOf("要查找的内容", s);
if (result >= 0)
{
this.textBox1.SelectionStart = result;
this.textBox1.SelectionLength = "要查找的内容".Length;
this.textBox1.ScrollToCaret();
}
else
{
MessageBox.Show("没找着");
}
jointan 2006-10-21
  • 打赏
  • 举报
回复
int s = this.textBox1.SelectionStart;
if (this.textBox1.SelectedText == "要查找的内容")
{
s++;
}
int result = this.textBox1.Text.IndexOf("要查找的内容", s);
if (result >= 0)
{
this.textBox1.SelectionStart = s;
this.textBox1.SelectionLength = "要查找的内容".Length;
this.textBox1.ScrollToCaret();
}
else
{
MessageBox.Show("没找着");
}

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧