Exemple #1
0
        private void btn_openFile_Click(object sender, EventArgs e)
        {
            string       path     = defaultPath + lst_showSpecifyFiles.Text;
            FileStream   filename = new FileStream(path, FileMode.Open, FileAccess.Read);
            StreamReader sr       = new StreamReader(filename, Encoding.Default);

            anotherform.ttxt_fileText.Text = sr.ReadToEnd();
            FileInfo fi = new FileInfo(path);

            anotherform.Text = ("创建时间:" + fi.CreationTime.ToString() + "  写入文件的时间" + fi.LastWriteTime + "  访问的时间" + fi.LastAccessTime);
            anotherform.ShowDialog();
            sr.Close();
        }
Exemple #2
0
        private void lst_showSpecifyFiles_DoubleClick(object sender, EventArgs e)//执行双击事件
        {
            string Chose_FileName = lst_showSpecifyFiles.SelectedItem.ToString();

            FileStream   filename = new FileStream(Chose_FileName, FileMode.Open, FileAccess.Read);
            StreamReader sr       = new StreamReader(filename, Encoding.Default);

            anotherform.ttxt_fileText.Text = sr.ReadToEnd();
            FileInfo fi = new FileInfo(Chose_FileName);

            anotherform.Text = ("创建时间:" + fi.CreationTime.ToString() + "  写入文件的时间" + fi.LastWriteTime + "  访问的时间" + fi.LastAccessTime);
            anotherform.ShowDialog();
            sr.Close();
        }