标题:求指导
取消只看楼主
gxzsqh
Rank: 1
来 自:淮安
等 级:新手上路
帖 子:10
专家分:5
注 册:2012-10-26
结帖率:100%
已结贴  问题点数:20 回复次数:0 
求指导
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Win32;
using

namespace WhileStatement
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>

    public partial class MainWindow : Window
    {
        private OpenFileDialog openFileDialog = null;

        public MainWindow()
        {
            InitializeComponent();//
            openFileDialog = new OpenFileDialog();//
            openFileDialog.FileOk += openFileDialogFileOk;//
        }

        private void openFileClick(object sender, RoutedEventArgs e)
        {
            openFileDialog.ShowDialog();//
        }

        private void openFileDialogFileOk(object sender, e)
        {
            string fullPathname = openFileDialog.FileName;
            FileInfo src = new FileInfo(fullPathname);
            fileName.Text = src.Name;//打开文件目录获取选中文件

            source.Text = "";//打开新文件之前先清空文本框
            TextReader reader = src.OpenText();//打开文件
            string line = reader.ReadLine();//读取文件中的一行(从第一行开始)
            while (line != null)
            {
                source.Text += line + '\n';
                line = reader.ReadLine();//读新的一行 空格照读 直到为空  空格读出来还是空格
            }
            reader.Close();//关闭文件
        }

        private void source_TextChanged(object sender, TextChangedEventArgs e)
        {

        }
    }
}



 openFileDialog是什么
在帮个忙加个注释 (有//的地方)
搜索更多相关主题的帖子: namespace 
2012-11-25 19:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-388377-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.213995 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved