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();
int index = this.richTextBox1.Find(s);
if (index < 0)
{
MessageBox.Show("查找不到");
return;
}
this.richTextBox1.SelectionStart = index;
this.richTextBox1.SelectionLength = s.Length;
this.richTextBox1.Focus();
wParam设置为0。
lParam指定为行数。
richtextbox1.ScrollToCast();
SendMessage(RichEdit1.Handle, EM_LINESCROLL, 0, LineNumber);
{
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);
}