日期:2014-05-17  浏览次数:20685 次

textbox 光标定位问题
       private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            // openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter = "文本文件|*.*|C#文件|*.cs|所有文件|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    
                    textBox1.Text = System.IO.File.ReadAllText(openFileDialog.FileName, Encoding.Default);

                  
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }



如何在打开文件后 把光标定位到指定的一行 和某个位置  就累世与书签   谢谢大神们