资源简介
c#的一个拥有多窗口MDI的记事本小小程序,基本实现了记事本所有功能,课堂程序,仅供参考,共同进步。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Note
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void mnuNew_Click(object sender EventArgs e)
{
FrmChild frmCld = new FrmChild();
frmCld.MdiParent = this;
Button btn = new Button();
btn.AutoSize = true;
btn.Height = 25;
btn.Width = 60;
btn.Margin = btn.Padding = new Padding(0);
btn.Text = “无标题“;
btn.Font = new Font(“宋体“9);
flowLayoutPanel1.Controls.Add(btn);
btn.Click+=new EventHandler(btn_Click);
btn.Tag = frmCld;
frmCld.Tag = btn;
frmCld.Show();//新建和后面的打开子窗口,Show出来的时候都包含激活,如果写在new Button前面的话,激活的活动子窗口还没有跟它对应的Button
}
private void mnuOpen_Click(object sender EventArgs e)
{
DialogResult result = openFileDialog1.ShowDialog();
if (result != System.Windows.Forms.DialogResult.OK)
{
return;
}
string path = openFileDialog1.FileName;
FrmChild frmCld = new FrmChild();
frmCld.MdiParent = this;
frmCld.Text = path;
frmCld.textBox1.Text = File.ReadAllText(path Encoding.Default);
Button btn = new Button();
btn.AutoSize = true;
btn.Height = 25;
btn.Width = 60;
btn.Margin = btn.Padding = new Padding(0);
btn.Text = Path.GetFileName(path);
btn.Font = new Font(“宋体“ 9);
flowLayoutPanel1.Controls.Add(btn);
btn.Click += new EventHandler(btn_Click);
btn.Tag = frmCld;
frmCld.Tag = btn;
frmCld.Show();
}
private void btn_Click(object sender EventArgs e)
{
Form current = (sender as Button).Tag as Form;
current.Activate();
foreach (Button btn in flowLayoutPanel1.Controls)
{
btn.Flatstyle = Flatstyle.System;
}
(sender as Button).Flatstyle = Flatstyle.Flat;
}
private void mnuPageSet_Click(object sender EventArgs e)
{
pageSetupDialog1.Document = printDocument1;
pageSetupDialog1.EnableMetric = true; //解决页边距单位转换问题
pageSetupDialog1.ShowDialog();
}
private void mnuPrint_Click(object sender EventArgs e)
{
printDialog1.Document = printDocument1;
DialogResult result = printDialog1.ShowDialog();
if (result != System.Windows.Forms.DialogResult.OK)
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-10-28 15:32 记事本\
目录 0 2014-10-28 15:32 记事本\Note\
文件 33371 2014-10-28 11:37 记事本\Note\Form1.Designer.cs
文件 11841 2014-10-28 11:37 记事本\Note\Form1.cs
文件 16455 2014-10-28 11:37 记事本\Note\Form1.resx
文件 5405 2014-10-28 11:18 记事本\Note\FrmChild.Designer.cs
文件 5552 2014-10-28 11:18 记事本\Note\FrmChild.cs
文件 6216 2014-10-28 11:18 记事本\Note\FrmChild.resx
文件 5192 2014-10-28 11:27 记事本\Note\Note.csproj
文件 485 2014-10-28 11:18 记事本\Note\Program.cs
目录 0 2014-10-28 15:32 记事本\Note\Properties\
文件 1364 2014-10-28 11:18 记事本\Note\Properties\AssemblyInfo.cs
文件 2832 2014-10-28 11:18 记事本\Note\Properties\Resources.Designer.cs
文件 5612 2014-10-28 11:18 记事本\Note\Properties\Resources.resx
文件 1102 2014-10-28 11:18 记事本\Note\Properties\Settings.Designer.cs
文件 249 2014-10-28 11:18 记事本\Note\Properties\Settings.settings
文件 8377 2014-10-28 15:05 记事本\Note\Replace.Designer.cs
文件 2797 2014-10-28 15:15 记事本\Note\Replace.cs
文件 5814 2014-10-28 15:05 记事本\Note\Replace.resx
目录 0 2014-10-28 15:32 记事本\Note\bin\
目录 0 2014-10-28 15:32 记事本\Note\bin\Debug\
文件 43008 2014-10-28 15:08 记事本\Note\bin\Debug\Note.exe
文件 73216 2014-10-28 15:08 记事本\Note\bin\Debug\Note.pdb
文件 14328 2014-10-28 15:09 记事本\Note\bin\Debug\Note.vshost.exe
文件 490 2007-07-21 01:33 记事本\Note\bin\Debug\Note.vshost.exe.manifest
文件 6329 2014-10-28 11:18 记事本\Note\frmFind.Designer.cs
文件 2413 2014-10-28 11:18 记事本\Note\frmFind.cs
文件 5814 2014-10-28 11:18 记事本\Note\frmFind.resx
文件 3742 2014-10-28 11:27 记事本\Note\frmGoto.Designer.cs
文件 987 2014-10-28 11:28 记事本\Note\frmGoto.cs
文件 5814 2014-10-28 11:27 记事本\Note\frmGoto.resx
............此处省略20个文件信息
- 上一篇:C# 最短路径 Dijkstra算法实现
- 下一篇:c# 自动序号生成
相关资源
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
- C#指纹识别系统程序 报告
- c# 高校档案信息管理系统
- c#向word文件插入图片
评论
共有 条评论