实验报告Word文档格式.docx
《实验报告Word文档格式.docx》由会员分享,可在线阅读,更多相关《实验报告Word文档格式.docx(25页珍藏版)》请在冰豆网上搜索。
中等
及格
不及格
遵守机房规章制度
上机表现
学习态度
基础知识水平
程序设计能力
课题功能实现情况
算法设计合理性
用户界面友好性
报告书写认真程度
报告内容完整性
文字表达清楚程度
问题回答准确性
评分等级
教师签名:
年月日
备注
注:
评分等级分为五种:
优秀、良好、中等、及格、不及格
目录
前言2
题目一2
1、问题分析。
2
2、设计方案。
3、流程图。
4、测试数据、测试结果、结果分析。
5、相关运行界面。
6、关键代码2
题目二3
3
6、关键代码3
题目三4
4
6、关键代码4
题目四5
5
6、关键代码5
小节6
附录6
前言
题目一
I012M
绘图程序
要求:
(1)具备直线、正方形、圆的绘图功能;
(2)对所绘图形具有涂色功能;
(3)具有保存功能。
M
建立graphics对象,分别用drawline,drawrectangle,drawellipse绘图。
用fillrectangle,fillellipse填充
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
namespaceWindowsApplication3
{
publicpartialclassForm1:
Form
{
publicForm1()
InitializeComponent();
}
privatevoid画直线ToolStripMenuItem_Click(objectsender,EventArgse)
Imagemyimage=newBitmap(pictureBox1.Width,pictureBox1.Height);
Graphicsg=Graphics.FromImage(myimage);
g.Clear(pictureBox1.BackColor);
Penp1=newPen(Color.Salmon,4);
Pointpo1=newPoint(200,50);
Pointpo2=newPoint(40,150);
g.DrawLine(p1,po1,po2);
pictureBox1.Image=myimage;
privatevoid画正方形ToolStripMenuItem_Click(objectsender,EventArgse)
Penpen=newPen(Color.Pink,3);
g.DrawRectangle(pen,100,100,150,150);
privatevoid画圆ToolStripMenuItem1_Click(objectsender,EventArgse)
g.Clear(this.BackColor);
Penpen=newPen(Color.Red,3);
g.DrawEllipse(pen,100,100,150,150);
privatevoid涂色ToolStripMenuItem_Click(objectsender,EventArgse)
SolidBrushbrush=newSolidBrush(Color.Pink);
g.FillRectangle(brush,100,100,150,150);
privatevoid涂色ToolStripMenuItem1_Click(objectsender,EventArgse)
SolidBrushbrush=newSolidBrush(Color.Red);
g.FillEllipse(brush,100,100,150,150);
privatevoid保存ToolStripMenuItem_Click(objectsender,EventArgse)
stringstr1;
SaveFileDialogsaveFileDialog1=newSaveFileDialog();
Bitmapbox1=newBitmap(pictureBox1.Image);
saveFileDialog1.Filter="
BmpFile(*.bmp)|*.bmp|AllFile(*.*)|*.*"
;
if(saveFileDialog1.ShowDialog()==DialogResult.OK)
str1=saveFileDialog1.FileName;
pictureBox1.Image.Save(str1);
}
6、关键代码
题目二
I014H
编写绘制正弦曲线的程序。
程序运行如图所示,点击“绘制”按钮,在窗体中的白色绘图区域生成一个红色的正弦曲线。
要求程序可以绘制四种数学曲线:
正弦曲线、余弦曲线、正切曲线和余切曲线,
因为要绘制多条数学曲线我决定用c#软件来帮助我。
通过观察我知道了这个题目需要分类讨论来实现。
namespaceWindowsApplication2
privatevoidForm1_Load(objectsender,EventArgse)
privatevoidpictureBox1_Click(objectsender,EventArgse)
privatevoidbutton3_Click(objectsender,EventArgse)
Graphicsg=pictureBox2.CreateGraphics();
//创建对象
Penpen1=newPen(Color.Red,4);
//创建画笔
floatx1,x2,y1,y=80;
for(intx=0;
x<
=360;
x++)
x1=(float)x;
//起始点x
x2=(float)(x+1);
//结束点x
//计算结束点y值
y1=(float)(80+50*Math.Sin((3.14159/180)*(x)));
g.DrawLine(pen1,x1,y,x2,y1);
//画线
y=y1;
//赋下一线段的起始点y