using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using
namespace 时光机
{
public partial class Form6 : Form
{
public Form6()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
richTextBox1.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream("留言板.txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.Flush();
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(richTextBox1.Text);
m_streamWriter.Flush();
m_streamWriter.Close();
richTextBox1.Text = "";
}
private void button3_Click(object sender, EventArgs e)
{
button1.Visible = false;
button2.Visible = false;
button4.Visible = true;
FileStream fs = new FileStream("留言板.txt", FileMode.Open, FileAccess.Read);
StreamReader m_streamReader = new StreamReader(fs);
m_streamReader.BaseStream.Seek(0, SeekOrigin.Begin);
this .richTextBox1.Text="";
string strLine=m_streamReader.ReadLine();
while(strLine!=null)
{
this .richTextBox1.Text+=strLine+"\n";
strLine=m_streamReader.ReadLine();
}
m_streamReader.Close();
}
private void button4_Click(object sender, EventArgs e)
{
button4.Visible = false;
button1.Visible = true;
button2.Visible = true;
richTextBox1.Text = "";
}
private void Form6_Load(object sender, EventArgs e)
{
}
}
}
这个“我说”按钮开始时候是设置为隐藏的。我也是菜鸟啊。。。你凑合着看吧