1、可以读取大文件(2G)2、实现首页、下一页、前一页、末页的跳转4、限制每页显示字符数 1029-4069byte,且用户可自定义该值现在基本功能实现了,但是想用多线程来实现,假如可以同时可以开两个线程,每次可以读2M到到缓冲区
这样子就有一个问题,最后怎么合并呢?或者谁能给个比较好的解决方案啊,感激不尽!意见采纳者另外开贴加100分

解决方案 »

  1.   

    new Thread((ThreadStart)delegate
        {
            StreamReader sr = new StreamReader(FileName, Encoding.GetEncoding("gb2312"));
            int line = 0;
            string strline = sr.ReadLine();
            while (strline!="")
            {
                line++;
                strline = sr.ReadLine();
            }
            sr.Close();
        }).Start();
    使用锁lock
      

  2.   

    http://www.codeproject.com/KB/database/CsvReader.aspx
      

  3.   

    一般读取大文件不是分页,而是动态加载,也就是滚动条滚动到某个位置后,加载该位置的数据,就像UltraEdit,新版本好像不及老版本速度快,建议用11.20b以前的版本查看效果,速度很快。
    对于读取StreamReader的行定位足够实现动态加载数据了,但是要更改就不是那么容易,毕竟你不是所有数据加载到内存里修改,真要这么做,内存是不够的。要实时插入或者删除文本内容,用StreamWriter是做不到的,等待高手提供API的解决方案。
      

  4.   

    关注这个。我也想知道。不过我的用在winform中。
      

  5.   

    每页1029-4069byte,直接Seek就行了,啥技术都不需要
      

  6.   

    一次读取一点,大文件操作应该没有问题的
    private int _bufferSize = 16384; private void ReadFile(string filename) 
    {
        StringBuilder stringBuilder = new StringBuilder();     
        FileStream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);      using (StreamReader streamReader = new StreamReader(fileStream))     
        {        
            char[] fileContents = new char[_bufferSize];         
            int charsRead = streamReader.Read(fileContents, 0, _bufferSize);         // Can't do much with 0 bytes        
            if (charsRead == 0)             
                throw new Exception("File is 0 bytes");         while (charsRead > 0)         
            {             
                stringBuilder.Append(fileContents);             
                charsRead = streamReader.Read(fileContents, 0, _bufferSize); 
            }     
        } 
    }
      

  7.   

    自己实现分页 
    http://topic.csdn.net/u/20091025/21/76bdeb3b-0825-47af-b5aa-08069e4a6354.html
      

  8.   

    可以读到数据库,再用datagridview 分页显示..........................................
    或者分割文件,存为几个数组.using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace _2_DataSourceArray  //显示数组中的数据,用包装器类
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void getData_Click(object sender, EventArgs e)
            {
                // Uncomment to see what happens with strings...
                //string[] items = new string[] { "One", "Two", "Three" };            Item[] items = new Item[] { new Item ( "One" ) , 
     new Item ( "Two" ) , 
     new Item ( "Three" ) };            dataGridView1.AutoGenerateColumns = true;
                dataGridView1.DataSource = items;
            }        protected class Item
            {
                public Item(string text)
                {
                    m_text = text;
                }            public string Text
                {
                    get { return m_text; }
                }            private string m_text;
            }    }
    }