新建窗体应用程序
创建菜单栏:menuStrip
创建工具栏: toolstrip
创建状态栏:statusstrip
工具栏新建按钮buttonn
属性image可改为自定义图片,text可添加文字,displaystyle设置显示图片或者文字
textimagerelation属性可定义文字与图片的关系
属性image可改为自定义图片,text可添加文字,displaystyle设置显示图片或者文字
textimagerelation属性可定义文字与图片的关系
新建textbox,
dock属性
菜单栏中的设置
复制选择事件:click
textBox1.Copy();
粘贴选择事件:click
粘贴textBox1.Paste();
打开 选择事件:click
if (DialogResult.OK == openFileDialog1.ShowDialog())
{
var fname = openFileDialog1.FileName;
StringBuilder sb = new StringBuilder();
using (StreamReader sr = new StreamReader(fname))
{
string line;
while ((line = sr.ReadLine())!=null)
{
sb.AppendLine(line);
}
}
textBox1.Text = sb.ToString();
// MessageBox.Show(openFileDialog1.FileName);
}
保存 选择事件:click
if (DialogResult.OK == saveFileDialog1.ShowDialog())
{
var filename = saveFileDialog1.FileName;
// StringBuilder sb = new StringBuilder();
using (StreamWriter sw = new StreamWriter(filename))
{
sw.WriteLine(textBox1.Text);
}
MessageBox.Show("保存成功");





