C#期末作业 实验报告计算机080303100327.docx
- 文档编号:28680825
- 上传时间:2023-07-19
- 格式:DOCX
- 页数:108
- 大小:387.86KB
C#期末作业 实验报告计算机080303100327.docx
《C#期末作业 实验报告计算机080303100327.docx》由会员分享,可在线阅读,更多相关《C#期末作业 实验报告计算机080303100327.docx(108页珍藏版)》请在冰豆网上搜索。
C#期末作业实验报告计算机080303100327
C#课程设计期末实验报告
一、目的与要求
1.目的:
1)要求学生达到熟练掌握.NET基本结构以及C#语言的基本知识和技能;
2)基本掌握面向对象程序开发的基本思路和方法;
3)掌握GUI、GDI+、文件、网络及ADO.NET数据库开发基本知识;
4)能够利用所学的基本知识和技能,进行简单应用程序设计。
2.要求
基本要求:
1)要求利用C#的编程思想以及组件开发原理来完成系统的设计;
2)突出C#语言与其它语言不同点(即体现C#的高级功能,如属性概念、接口、事件、委托等);
3)体现可视化编程基本东西,如系统带有菜单、工具栏、状态栏以及常用的高级控件。
创新要求:
在基本要求达到后,可进行创新设计,如把系统转化为组件、给系统在数据方面具有导入导出功能、增加文件传输功以及远程控制功能等。
报告内容包括:
一·程序设计思路
利用C#制作类似于图片浏览器的工具,基本功能为:
上一张,下一张,幻灯片等,但是还可以播放音乐,连接网址等功能。
1·先设计主界面。
主界面包括一个主菜单(mainmenu),一个contextmenu,一个工具栏(toolbar),一个picturebox,一个panel,一个statusbar,一个时间控制timer,一个图片imagelist和一个保存控件savefiledialog。
同时里面的各个部件也要同时到位:
比如主菜单里面的文件打开与保存,视图,工具等等。
还有父菜单里面的大部分功能键:
打开,复制,删除等等。
先确定要引用的系统工具:
usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
usingSystem.Data;
usingSystem.IO;
usingMicrosoft.DirectX;
usingMicrosoft.DirectX.AudioVideoPlayback;
usingSystem.Diagnostics;
定义函数:
privateSystem.Windows.Forms.MainMenumainMenu1;
privateSystem.Windows.Forms.MenuItemmenuItem1;
privateSystem.Windows.Forms.MenuItemmenuItem2;
privateSystem.Windows.Forms.MenuItemmenuItem3;
privateSystem.Windows.Forms.MenuItemmenuItem4;
privateSystem.Windows.Forms.MenuItemmenuItem5;
privateSystem.Windows.Forms.MenuItemmenuItem6;
privateSystem.Windows.Forms.ToolBartoolBar1;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton1;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton2;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton3;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton4;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton5;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton6;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton7;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton8;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton9;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton10;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton11;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton12;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton13;
privateSystem.Windows.Forms.Panelpanel1;
privateSystem.Windows.Forms.PictureBoxpictureBox1;
privateSystem.Windows.Forms.StatusBarstatusBar1;
privateSystem.Windows.Forms.StatusBarPanelstatusBarPanel1;
privateSystem.Windows.Forms.StatusBarPanelstatusBarPanel2;
privateSystem.Windows.Forms.StatusBarPanelstatusBarPanel3;
privateSystem.Windows.Forms.StatusBarPanelstatusBarPanel4;
privateSystem.Windows.Forms.OpenFileDialogopenFileDialog1;
privateSystem.Windows.Forms.Timertimer1;
privateSystem.ComponentModel.IContainercomponents;
privatestringentireFilePath;
privatestringentireFilePath2;
privateintindex=-1;
privateSystem.Windows.Forms.MenuItemmenuItem7;
privateArrayListFileInDir;
publicinttimes;
privateSystem.Windows.Forms.ContextMenucontextMenu1;
privateSystem.Windows.Forms.MenuItemmenuItem8;
privateSystem.Windows.Forms.MenuItemmenuItem9;
privateSystem.Windows.Forms.MenuItemmenuItem10;
privateSystem.Windows.Forms.MenuItemmenuItem11;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton14;
privateSystem.Windows.Forms.ContextMenucontextMenu2;
privateSystem.Windows.Forms.MenuItemmenuItem13;
privateSystem.Windows.Forms.MenuItemmenuItem14;
privateSystem.Windows.Forms.MenuItemmenuItem15;
privateSystem.Windows.Forms.MenuItemmenuItem12;
privateSystem.Drawing.BitmapNewBitmap;
privateintti;
privateintflag=0;
privateBitmapMyImage=null;
PointStartPoint=newPoint(0,0);
privateSystem.Windows.Forms.SaveFileDialogsaveFileDialog1;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton15;
privateSystem.Windows.Forms.MenuItemmenuItem16;
privateSystem.Windows.Forms.MenuItemmenuItem17;
privateSystem.Windows.Forms.MenuItemmenuItem18;
privateSystem.Windows.Forms.MenuItemmenuItem19;
privateSystem.Windows.Forms.MenuItemmenuItem20;
privateSystem.Windows.Forms.MenuItemmenuItem21;
privateSystem.Windows.Forms.MenuItemmenuItem22;
privateSystem.Windows.Forms.MenuItemmenuItem23;
privateSystem.Windows.Forms.MenuItemmenuItem24;
privateSystem.Windows.Forms.MenuItemmenuItem25;
privateSystem.Windows.Forms.ImageListimageList1;
privateSystem.Windows.Forms.MenuItemmenuItem27;
privateSystem.Windows.Forms.MenuItemmenuItem26;
privateSystem.Drawing.BitmapMyBitmap;
图片如下:
二.程序结构的框架图
Form1主程序:
ImageExplorer和窗体实现函数InitializeComponent()
一级:
openImage()打开图片;Form1_SizeChanged(objectsender,System.EventArgse)当窗体改变时,框中控件的位置不变还有主菜单和副菜单中的一系列控件函数
pictureBox1_DragEnter(objectsender,System.Windows.Forms.DragEventArgse)
Form1_DragEnter(objectsender,System.Windows.Forms.DragEventArgse)
menuItem1(2,3,4,5,6,7,8,9。
。
。
。
。
。
)_Click(objectsender,System.EventArgse)
pictureBox1_Paint(objectsender,System.Windows.Forms.PaintEventArgse)
Dispose(booldisposing)
二级:
max()min()放大缩小图片
viewImage(boolmark)幻灯片式浏览图片
delfile()删除图片shiheView()适合显示rad()随机显示
三级:
HbycView()VbycView()rtlView()utdView()ksView()fzView()lblsView()fsView()fdView()hbView()rhView()whView()RhView()一系列图片的处理
preView()nextView()上一张和下一张图片
toolBarBtnEnable()控制上一张按钮和下一张按钮使用状态
Form2主程序:
ImageExplorer和窗体InitializeComponent()
Button1(2,3,4。
。
。
)_Click(objectsender,System.EventArgse)
checkBox2_CheckedChanged(objectsender,System.EventArgse)
ClipEnded(objectsender,System.EventArgse)
OpenFile()打开媒体文件
openVido()打开音乐
Form3主程序:
ImageExplorer和窗体InitializeComponent()
鼠标的上下左右左键右键函数:
Form3_MouseDown(objectsender,System.Windows.Forms.MouseEventArgse)
Form3_MouseMove(objectsender,System.Windows.Forms.MouseEventArgse)
Form3_MouseUp(objectsender,System.Windows.Forms.MouseEventArgse)
Form3_KeyUp(objectsender,System.Windows.Forms.KeyEventArgse)
Form3_Load(objectsender,System.EventArgse)
Form3_Paint(objectsender,System.Windows.Forms.PaintEventArgse)
Form3_DoubleClick(objectsender,System.EventArgse)
Qscreen()截取图片函数
Form4主程序:
ImageExplorer和窗体InitializeComponent()
Dispose(booldisposing)
三.模块或类的设计
一共有4个模块分别由4个类来实现
:
Form1,Form2,Form3,Form4
第一个类为总的类,分别调用了其他3个类里面的函数:
publicclassForm1:
System.Windows.Forms.Form
第二各类为参数设置的类:
它包括了音乐的选择和图片浏览的时间动态显示以及保存路径
publicclassForm2:
System.Windows.Forms.Form
第三各类为图片截取的类:
它包括了图片截取,鼠标的操作和截取的方法
publicclassForm3:
System.Windows.Forms.Form
第四各类为图片浏览时画面的设置的类,还没有完善:
publicclassForm4:
System.Windows.Forms.Form
四.关键源代码编程步骤
先要想好一共需要几段代码,有4类所以要4个Form来实现,
首先是Form1的编写,它是本程序的最主要部分,承担了调用其他类的职责,所以应该最先设计好:
usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
usingSystem.Data;
usingSystem.IO;
usingMicrosoft.DirectX;
usingMicrosoft.DirectX.AudioVideoPlayback;
usingSystem.Diagnostics;
namespaceImageExplorer
{
///
///Form1的摘要说明。
///
publicclassForm1:
System.Windows.Forms.Form
{
privateSystem.Windows.Forms.MainMenumainMenu1;
privateSystem.Windows.Forms.MenuItemmenuItem1;
privateSystem.Windows.Forms.MenuItemmenuItem2;
privateSystem.Windows.Forms.MenuItemmenuItem3;
privateSystem.Windows.Forms.MenuItemmenuItem4;
privateSystem.Windows.Forms.MenuItemmenuItem5;
privateSystem.Windows.Forms.MenuItemmenuItem6;
privateSystem.Windows.Forms.ToolBartoolBar1;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton1;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton2;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton3;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton4;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton5;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton6;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton7;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton8;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton9;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton10;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton11;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton12;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton13;
privateSystem.Windows.Forms.Panelpanel1;
privateSystem.Windows.Forms.PictureBoxpictureBox1;
privateSystem.Windows.Forms.StatusBarstatusBar1;
privateSystem.Windows.Forms.StatusBarPanelstatusBarPanel1;
privateSystem.Windows.Forms.StatusBarPanelstatusBarPanel2;
privateSystem.Windows.Forms.StatusBarPanelstatusBarPanel3;
privateSystem.Windows.Forms.StatusBarPanelstatusBarPanel4;
privateSystem.Windows.Forms.OpenFileDialogopenFileDialog1;
privateSystem.Windows.Forms.Timertimer1;
privateSystem.ComponentModel.IContainercomponents;
privatestringentireFilePath;
privatestringentireFilePath2;
privateintindex=-1;
privateSystem.Windows.Forms.MenuItemmenuItem7;
privateArrayListFileInDir;
publicinttimes;
privateSystem.Windows.Forms.ContextMenucontextMenu1;
privateSystem.Windows.Forms.MenuItemmenuItem8;
privateSystem.Windows.Forms.MenuItemmenuItem9;
privateSystem.Windows.Forms.MenuItemmenuItem10;
privateSystem.Windows.Forms.MenuItemmenuItem11;
privateSystem.Windows.Forms.ToolBarButtontoolBarButton14;
privateSystem.Windows.Forms.ContextMenucontextMenu2;
privateSystem.Windows.Forms.MenuItemmenuItem13;
privateSystem.Windows.Forms.MenuItemmenuItem14;
privateSystem.Windows.Forms.MenuItemmenuItem15;
privateSystem.Windows.Forms.MenuItemmenuItem12;
privateSystem.Drawing.BitmapNewBitmap;
//privateAudioourAudio=null;
//privateboolvie=false;
privateintti;
privateintflag=0;
privateBitmapMyImage=null;
//创建一个Bitmap实例
//privateboolStartedCrop=false;
//设定标识位
PointStartPoint=newPoint(0
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C#期末作业 实验报告计算机080303100327 C# 期末 作业 实验 报告 计算机 080303100327
![提示](https://static.bdocx.com/images/bang_tan.gif)