在查找中怎样才能得到上一次查找结束时亮块的位置,因为我想做一个“查找下一个”按钮但是要做查找下一个按钮 就必须知道上一次查找结束是的光标的位置  因为查找函数中的第二个参数就是查找的起始位置  那查找下一个的起始位置就是第一次查找结束时亮块的位置  所以怎么才能得到第一次结束时亮块所在的位置啊  谢谢了

解决方案 »

  1.   

    把它保存在session中(对于asp中),不知是不是LZ想要的??
      

  2.   

    针对winform可以在程序中或者其他文件中保存一下当前查找的位置,然后在点击继续查找的时候读取位置信息。
      

  3.   

    搂主使用的是不是RichTextBox?是的话应该这样做:
    private int FindNext(string text, bool bMatchCase, bool bReverse)
    {
        if (text == null) return -1;    this.richTextBox1.Focus();    RichTextBoxFinds findOptions = RichTextBoxFinds.None;    int start = this.richTextBox1.SelectionStart;
        int end = start;    if (bReverse)
        {
            start = 0;
            end = this.richTextBox1.SelectionStart;
            findOptions |= RichTextBoxFinds.Reverse;
        }
        else
        {
            start += this.richTextBox1.SelectionLength;
            end = this.richTextBox1.TextLength;
            this.richTextBox1.SelectionStart = start;
        }
        this.richTextBox1.SelectionLength = 0;    if (bMatchCase)
        {
            findOptions |= RichTextBoxFinds.MatchCase;
        }
        return this.richTextBox1.Find(text, start, end, findOptions);
    }搂主直接调用这个函数应该可以实现你的需求
      

  4.   

    保存在session 或者
    application 里面。
    具体哪一个看你自己需要
      

  5.   

    string text, bool bMatchCase, bool bReverse这几个变量分别代表什么意思啊???
      

  6.   

    text-将要被查找的文本;bMatchCase-是否区分大小写;bReverse-是否反向查找
      

  7.   

    搂主可以下载下面我专门针对文本编辑器软件写的查找和替换功能代码:
    http://download.csdn.net/source/894891
    该功能已经做得很完善,可以参考