string s="";
int index = this.richTextBox1.Find(s);
if (index < 0)
{
  MessageBox.Show("查找不到");
  return;
}
this.richTextBox1.SelectionStart = index;
this.richTextBox1.SelectionLength = s.Length;
this.richTextBox1.Focus();

解决方案 »

  1.   

    发送 EM_LINESCROLL 消息
    wParam设置为0。
    lParam指定为行数。
      

  2.   

    发送 EM_LINESCROLL 消息?具体一点,不会...
      

  3.   

    记事本主界面是richtextbox,在转到对话框中是textbox
      

  4.   

    richtextbox1.SelectedIndex = 0;
    richtextbox1.ScrollToCast();
      

  5.   

    声明API。然后
    SendMessage(RichEdit1.Handle, EM_LINESCROLL, 0, LineNumber);
      

  6.   

     private void 转到ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form5 f5 = new Form5();
                f5.LineNumber = SendMessage(this.richTextBox1.Handle, EM_LINEFROMCHAR, this.richTextBox1.SelectionStart, 0) + 1;
                    if ((f5.ShowDialog() == DialogResult.OK) && (f5.LineNumber < this.richTextBox1.Lines.Length))
                    {
                        this.richTextBox1.SelectionLength = 0;
                        this.richTextBox1.SelectionStart = SendMessage(this.richTextBox1.Handle, EM_LINEINDEX, f5.LineNumber - 1, 0);
                        this.richTextBox1.Focus();
                        Point cursorPos = GetCursorPos(this.richTextBox1);
                        this.toolStripStatusLabel2.Text = "行:" + cursorPos.Y.ToString() + " 列:" + cursorPos.X.ToString();
                    }
            
                // MessageBox.Show("行数超过范围", "记事本 -跳行", MessageBoxButtons.OK); 
            }
      

  7.   

    ? Point cursorPos = GetCursorPos(this.richTextBox1);中的 GetCursorPos()怎样写??