资源简介
这是武汉理工大学计算机学院可视化编程(C#)课程的第四次实验:窗体和控件综合设计 的源代码。运行环境:VS2017。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
int findPosition = 0;
string s_filename = ““;
//bool bsave = false;
public Form1()
{
InitializeComponent();
IsMdiContainer = true;
menuStrip1.MdiWindowListItem.Name = menuStrip1.Name;
}
private void Form1_Load(object sender EventArgs e)
{
}
private void Form1_FormClosing(object sender FormClosingEventArgs e)
{
if (!ifsaveoldfile()) e.Cancel = true;
}
private void numericUpDown1_ValueChanged(object sender EventArgs e)
{
}
private void ddToolStripMenuItem_Click(object sender EventArgs e)
{
}
private void 剪切ToolStripMenuItem_Click(object sender EventArgs e)
{
FormChild formChild = (FormChild)this.ActiveMdiChild;
formChild.richTextBox1.Cut();
}
private void 复制ToolStripMenuItem_Click(object sender EventArgs e)
{
FormChild formChild = (FormChild)this.ActiveMdiChild;
formChild.richTextBox1.Copy();
}
private void 粘贴ToolStripMenuItem_Click(object sender EventArgs e)
{
FormChild formChild = (FormChild)this.ActiveMdiChild;
formChild.richTextBox1.Paste();
}
public bool ifsaveoldfile()
{
FormChild formChild = (FormChild)this.ActiveMdiChild;
bool returnvalue = true;
if (formChild.bsave)
{
System.Windows.Forms.DialogResult dr;
dr = MessageBox.Show(this “要保存当前更改吗?““保存更改吗?“MessageBoxButtons.YesNoCancelMessageBoxIcon.Question);
switch (dr)
{
case System.Windows.Forms.DialogResult.Yes:
formChild.bsave = false;
if (s_filename.Length != 0) formChild.richTextBox1.SaveFile(s_filename RichTextBoxStreamType.PlainText);
else
{
SaveFileDialog saveFiledia1 = new SaveFileDialog();
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
s_filename = saveFileDialog1.FileName;
formChild.richTextBox1.SaveFile(s_filename RichTextBoxStreamType.PlainText);
}
}
returnvalue = true;
break;
case System.Windows.Forms.DialogRes
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-05-14 09:10 WindowsFormsApplication2\
目录 0 2018-05-14 09:10 WindowsFormsApplication2\.vs\
目录 0 2018-05-14 09:10 WindowsFormsApplication2\.vs\WindowsFormsApplication2\
目录 0 2018-05-14 09:11 WindowsFormsApplication2\.vs\WindowsFormsApplication2\v14\
文件 37376 2018-05-14 16:46 WindowsFormsApplication2\.vs\WindowsFormsApplication2\v14\.suo
目录 0 2018-05-14 16:32 WindowsFormsApplication2\WindowsFormsApplication2\
文件 189 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\App.config
文件 16767 2018-05-14 15:45 WindowsFormsApplication2\WindowsFormsApplication2\Form1.Designer.cs
文件 8807 2018-05-14 16:30 WindowsFormsApplication2\WindowsFormsApplication2\Form1.cs
文件 6824 2018-05-14 15:45 WindowsFormsApplication2\WindowsFormsApplication2\Form1.resx
文件 2223 2018-05-14 15:49 WindowsFormsApplication2\WindowsFormsApplication2\FormChild.Designer.cs
文件 712 2018-05-14 16:32 WindowsFormsApplication2\WindowsFormsApplication2\FormChild.cs
文件 5817 2018-05-14 15:49 WindowsFormsApplication2\WindowsFormsApplication2\FormChild.resx
文件 547 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\Program.cs
目录 0 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\Properties\
文件 1490 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\Properties\AssemblyInfo.cs
文件 2878 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\Properties\Resources.Designer.cs
文件 5612 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\Properties\Resources.resx
文件 1111 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\Properties\Settings.Designer.cs
文件 249 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\Properties\Settings.settings
文件 4624 2018-05-14 15:17 WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2.csproj
目录 0 2018-05-14 14:34 WindowsFormsApplication2\WindowsFormsApplication2\bin\
目录 0 2018-05-14 09:20 WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\
文件 19968 2018-05-14 16:32 WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe
文件 189 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe.config
文件 40448 2018-05-14 16:32 WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb
文件 22696 2018-05-14 09:11 WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe
文件 189 2018-05-14 09:10 WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.config
文件 490 2017-09-29 21:43 WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest
文件 40448 2018-05-14 16:32 WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.pdb
文件 5194 2018-05-14 14:55 WindowsFormsApplication2\WindowsFormsApplication2\formFindReplace.Designer.cs
............此处省略20个文件信息
- 上一篇:C#酒店管理系统课程设计报告
- 下一篇:远程桌面(简单鼠标按键控制)
评论
共有 条评论