using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace px3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{//用来打开文件的按钮
OpenFileDialog o = new OpenFileDialog();
o.Filter = "文本文件(*.txt)|*.txt";
if (o.ShowDialog()== DialogResult.Cancel) return;
this.textBox1.Text = o.FileName;//在文本框中写入打开的文件的文件名
}
private void textBox1_MouseDoubleClick(object sender, MouseEventArgs e)
{
button1_Click(sender,e);//双击文本框也能打开文件
}
p