c# 我做记事本,不知道转到怎样写
不知道怎样将光标转到指定行行首?richtextbox帮忙吧,这个问题困扰我都两天了......
QQ:389450349
谢谢了 --------------------编程问答-------------------- 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();
--------------------编程问答--------------------
ok --------------------编程问答-------------------- 发送 EM_LINESCROLL 消息
wParam设置为0。
lParam指定为行数。 --------------------编程问答-------------------- 发送 EM_LINESCROLL 消息?具体一点,不会... --------------------编程问答-------------------- 记事本主界面是richtextbox,在转到对话框中是textbox --------------------编程问答-------------------- richtextbox1.SelectedIndex = 0;
richtextbox1.ScrollToCast(); --------------------编程问答-------------------- ?能具体一点吗? --------------------编程问答-------------------- 好像不对哟 --------------------编程问答--------------------
声明API。然后
SendMessage(RichEdit1.Handle, EM_LINESCROLL, 0, LineNumber); --------------------编程问答-------------------- 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);
} --------------------编程问答-------------------- 好的,我试下 --------------------编程问答-------------------- 谢谢哈 --------------------编程问答-------------------- ? Point cursorPos = GetCursorPos(this.richTextBox1);中的 GetCursorPos()怎样写??
补充:.NET技术 , C#