net应用开发课程设计.docx
- 文档编号:27321428
- 上传时间:2023-06-29
- 格式:DOCX
- 页数:42
- 大小:2.36MB
net应用开发课程设计.docx
《net应用开发课程设计.docx》由会员分享,可在线阅读,更多相关《net应用开发课程设计.docx(42页珍藏版)》请在冰豆网上搜索。
net应用开发课程设计
编号
《.net应用开发》课程设计
题目1:
C#程序设计上机自测系统
题目2:
学生成绩管理系统
题目3:
C#图像处理工具软件
题目4:
编写一个使一只红色小圆球在一个方框内随机弹性碰撞的程序。
设计动画时,要求实现图像预加载
二级学院000000000000000000
专业生物医学工程
班级
学生姓名学号
指导教师
评阅教师
时间
一、课程设计概述:
本次数据结构课程设计共完成五个题:
1、C#程序设计上机自测系统
2、学生成绩管理系统
3、C#图像处理工具软件
4、编写一个使一只红色小圆球在一个方框内随机弹性碰撞的程序。
设计动画时,要求实现图像预加载。
使用语言:
C#
编译环境:
VS2010
二、课程设计题目一
[实验内容]
C#程序设计上机自测系统
[问题描述]
建立一个基于WinForms的上机自测系统设计
[需求分析]
1、能以填空、单选及多选方式进行客观答题。
2、要能计时功能,能记录完成题目自测时所耗的时间。
3、界面美观,操作简单。
4、可以选择初级、中级、高级3种题型。
5、交卷后系统能自动给出评分结果。
-=ADT=-
{
IntScore=0;
//总得分
this.timerl.Enabled=false;
//计时停止
this.btnGrade.Enabled=false;
//评分锁定
this.TotalScore.Text=Score.ToString();
//显示总得分
this.Close();
//强调Close方法关闭窗体PrimaryExmForm
Application.SetCompatibleTextRenderingDefault(false);
//设置启动窗口
Application.Exit();
//退出系统
PrimaryExmForm();
//调用show方法,显示窗口
AboutFormAbtFrm=AboutForm();
ABtFrm.showDialog();
//模态方式打开窗体
}
[存储结构]
namespaceWindowsApplication1
publicMainForm1()
{
InitializeComponent();
}
namespaceWindowsApplication1
{
publicpartialclassPrimaryExmFrom:
Form
{
publicPrimaryExmFrom()
{
InitializeComponent();
}
[流程图]
开始
系统界面
选择自测题难度,计时开始
初级自测题系统
高级级自测题系统
中级自测题系统
答题计时
评分退出
[详细设计]
得分和关闭的源程序:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
namespaceWindowsApplication1
{publicpartialclassPrimaryExmFrom:
Form
{publicPrimaryExmFrom()
{InitializeComponent();
}
intExamSecond=0;
privatevoidtimer1_Tick(objectsender,EventArgse)
{ExamSecond++;
this.ExamTime.Text=ExamSecond.ToString();
}
privatevoidbtnGrade_Click(objectsender,EventArgse)
{intScore=0;
if(this.Answer1.Text=="2000")Score=Score+10;
if(this.Answer21A.Checked)Score=Score+10;
if(this.Answer22C.Checked)Score=Score+10;
if(this.Answer23.Text=="PasswordChar")Score=Score+10;
if(this.Answer24.Text=="Text")Score=Score+10;
if(this.Answer3A.Checked&&this.Answer3B.Checked&&this.Answer3C.Checked&&!
this.Answer3D.Checked)
Score=Score+10;
this.timer1.Enabled=false;
this.btnGrade.Enabled=false;
this.TotalScore.Text=Score.ToString();
}
privatevoidbtnClose_Click(objectsender,EventArgse)
{this.Close();
}
自测题程序源代码:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
namespaceWindowsApplication1
{publicpartialclassMainForm1:
Form
{publicMainForm1()
{InitializeComponent();
}
privatevoid初级自测试题PToolStripMenuItem_Click(objectsender,EventArgse)
{
this.IsMdiContainer=true;
this.label1.Visible=false;
this.pictureBox1.Visible=false;
this.label2.Visible=false;
PrimaryExmFromPFrm=newPrimaryExmFrom();
PFrm.MdiParent=this;
PFrm.Show();
}
privatevoidtoolStripComboBox1_Click(objectsender,EventArgse)
{Form[]CFrmList=this.MdiChildren;
foreach(FormCFrminCFrmList)
{CFrm.Close();
}
}
privatevoidtoolStripButton1_Click(objectsender,EventArgse)
{Form[]CFrmList=this.MdiChildren;
foreach(FormCFrminCFrmList)
{CFrm.Close();}}}}
[调试分析]
本程序主要的操作是对窗口部分进行逐一的选择进入,在进入系统窗口后时间自动计时,当答完题目时,时间自动停止,并且计算出该得的总分数,并且整个过程要求连贯执行。
问题一:
现象:
点击进入系统后时间正常计时但点击评分后时间未停止
原因:
编写时钟程序的时候忘记编写停止程序。
找到相应的程序段后,将停止计时的程序编写上,时钟能够正常计时和停止了。
问题二:
现象:
点击评分后输出的评分不是正确的得分。
原因:
问题在于将程序段里对应的题目的代码写错位了,因而导致了评分的结果不能与实际得分相对应。
每一道题目在程序段中都要有相应的与之对应,并且要正确编写其分值。
[运行结果及分析]
[心得体会]
明白了Windows窗体和控件是开发C#应用程序的基础,在C#应用程序中扮演着重要角色,每个Window窗体和控件都是一个对象,也是一个实例。
进入系统的窗口简单美观大方,有帮助窗口。
也可以进入文件点击“退出”,该系统自动退出关闭。
点击“题型选择”里面有3种难度的题型可以选择,进入初级题型后,时钟开始计时所用时间。
答完题目后,点击评分时钟自动停止可以显示做题时间,同时系统计算出做题得分。
点击关闭回到进入系统窗口,点击文件后点击退出,系统自动关闭退出。
整个系统达到了建立上机自测题的要求。
2、课程设计题目四
[实验内容]
C#图像处理工具软件
[问题描述]
建立一个图像图处理工程软件,实现对图像的基础处理。
其中包括灰度化、灰度直方图、二值化、滤波、锐化。
[需求分析]
1、打开并保存图片
2、分别生成灰度图像,产生灰度直方图,可以进行图像锐化、二值化、滤波等功能。
3、在图像操作时,显示不同的效果图,是分别被处理过后的结果。
3、界面美观
[概要设计]
-=ADT=-
{
StringcuurrentImageFile;
//记录源文件路径
BitmapsourceBitmap;
//源图像
bitmap.Save(saveFileDialog1.FileName);
//保存图像文件
privatevoidbutton2_Click(objectsender,EventArgse);
//启动灰度化
Bitmapb=newBitmap(pictureBox1.Image);
GrayScale(b);
pictureBox2.Image=b;
//灰度化调用
privatevoidbutton5_Click(objectsender,EventArgse)
//二值化的启动
Bitmaps=newBitmap(pictureBox1.Image);
B(s);
pictureBox2.Image=s;
//二值化的调动
Bitmapq=newBitmap(pictureBox1.Image);
F(q);
pictureBox2.Image=q;
//滤波的调动
Bitmapa=newBitmap(pictureBox1.Image);
D(a);
pictureBox2.Image=a;
//锐化的调动
int[]countPixel=newint[256];
Bitmapsm=newBitmap(pictureBox1.Image);
pictureBox2.Image=sm;
if(sm!
=null)
//直方图的调动
Reture//返回
}
[存储结构]
{publicpartialclassForm1:
Form
{stringcurrentImageFile;
BitmapsourceBitmap;
BitmapprocessingBitmap;
publicForm1()
{InitializeComponent();
}
[流程图]
灰度化流程图:
开始
指定绘图
图像是否加载?
错误提示
否
锁存图像数据
是
指针移向
计算当前像素
移动指针至
指针图像结束?
否
解锁图像
是
绘制窗口
结束
[详细设计]
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Windows.Forms;
usingSystem.Drawing.Imaging;
usingMicrosoft.VisualBasic;
namespacehuidu
{
publicpartialclassForm1:
Form
{
publicForm1()
{
InitializeComponent();
}
privatevoidbutton1_Click(objectsender,EventArgse)
{
stringcF;
BitmapsourceBitmap;
OpenFileDialogop1=newOpenFileDialog();
op1=newOpenFileDialog();
op1.Filter="所有图片文件(*.bmp/*.jpg/*.gif)|*.*|Jpeg文件(*.jpg)|*.jpg|Bitmap文件|*.bmp|gif文件|*.gif";
op1.FilterIndex=2;
op1.RestoreDirectory=true;
if(DialogResult.OK==op1.ShowDialog())
{
cF=op1.FileName;
pictureBox1.Image=Bitmap.FromFile(cF,false);
sourceBitmap=(Bitmap)Image.FromFile(cF);
}
}
privatevoidbutton3_Click(objectsender,EventArgse)
{
SaveFileDialogsa1=newSaveFileDialog();
sa1=newSaveFileDialog();
sa1.Filter="Bitmap文件(*.bmp)|*.bmp|Jpeg文件(*.jpg)|*.jpg|gif文件(*.gif)|*.gif";
sa1.FilterIndex=2;
sa1.RestoreDirectory=true;
if(DialogResult.OK==sa1.ShowDialog())
{
Bitmapbitmap=newBitmap(pictureBox1.Image);
bitmap.Save(sa1.FileName);
}
}
privatevoidbutton2_Click(objectsender,EventArgse)
{
Bitmapb=newBitmap(pictureBox1.Image);
GrayScale(b);
pictureBox2.Image=b;
}
publicstaticboolGrayScale(Bitmapb)
{
BitmapDatabmData=b.LockBits(newRectangle(0,0,b.Width,b.Height),ImageLockMode.ReadWrite,PixelFormat.Format24bppRgb);
intstride=bmData.Stride;
System.IntPtrScan0=bmData.Scan0;
unsafe
{
byte*p=(byte*)(void*)Scan0;
intnOffset=stride-b.Width*3;
bytered,green,blue;
for(inty=0;y { for(intx=0;x { blue=p[0]; green=p[1]; red=p[2]; p[0]=p[1]=p[2]=(byte)(.299*red+.587*green+.114*blue); p+=3; } p+=nOffset; } } b.UnlockBits(bmData); returntrue; } privatevoidbutton4_Click(objectsender,EventArgse) { int[]countPixel=newint[256]; Bitmapsm=newBitmap(pictureBox1.Image); pictureBox2.Image=sm; if(sm! =null) { Rectanglerect=newRectangle(0,0,sm.Width,sm.Height); System.Drawing.Imaging.BitmapDatabmpData=sm.LockBits(rect,System.Drawing.Imaging.ImageLockMode.ReadWrite,sm.PixelFormat); intstrite=bmpData.Stride; System.IntPtrScan0=bmpData.Scan0; bytegrayScale=0; Array.Clear(countPixel,0,256); intmaxPixel=0; unsafe { byte*p=(byte*)(void*)Scan0; intnOffset=strite-sm.Width*1; for(inty=0;y { for(intx=0;x { grayScale=p[0]; countPixel[grayScale]++; if(countPixel[grayScale]>maxPixel) { maxPixel=countPixel[grayScale]; } p+=1; } p+=nOffset; } } sm.UnlockBits(bmpData); Pencurpen=newPen(Brushes.Black,1); Graphicsg=pictureBox1.CreateGraphics(); g.Clear(this.BackColor); g.DrawLine(curpen,50,200,250,200); g.DrawLine(curpen,50,200,50,30); g.DrawLine(curpen,100,200,100,197); g.DrawLine(curpen,125,200,125,197); g.DrawLine(curpen,150,200,150,197); g.DrawLine(curpen,175,200,175,197); g.DrawLine(curpen,200,200,200,197); g.DrawString("0",newFont("NewTimer",8),Brushes.Black,newPointF(46,195)); g.DrawString("50",newFont("NewTimer",8),Brushes.Black,newPointF(92,195)); g.DrawString("100",newFont("NewTimer",8),Brushes.Black,newPointF(139,195)); g.DrawString("150",newFont("NewTimer",8),Brushes.Black,newPointF(189,195)); g.DrawString("200",newFont("NewTimer",8),Brushes.Black,newPointF(239,195)); g.DrawString("250",newFont("NewTimer",8),Brushes.Black,newPointF(289,195)); g.DrawLine(curpen,47,40,50,40); g.DrawString(maxPixel.ToString(),newFont("NewTimer",8),Brushes.Black,newPointF(8,34)); doubletemp2=0; Pencurpen2=newPen(Brushes.Blue,1); for(inti=0;i<256;i++) { temp2=4000*countPixel[i]/maxPixel; g.DrawLine(curpen2,i-10,199,i-10,199-(int)temp2); } curpen.Dispose(); g.Dispose(); } } privatevoidbutton5_Click(objectsender,EventArgse) { Bitmaps=newBitmap(pictureBox1.Image); B(s); pictureBox2.Image=s; } publicstaticboolB(Bitmaps) { BitmapDatabmpData=s.LockBits(newRectangle(0,0,s.Width,s.Height),ImageLockMode.ReadWrite,PixelFormat.Format24bppRgb); intstride=bmpData.Stride; System.IntPtrScan0=bmpData.Scan0; unsafe { intblue; intDF=122;//=Convert.ToInt16(textBox1.Text); byte*p=(byte*)(bmpData.Scan0); for(inty=0;y
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- net 应用 开发 课程设计