实验三c#实验报告Word格式文档下载.docx

上传人:b****4 文档编号:7493817 上传时间:2023-05-08 格式:DOCX 页数:13 大小:189.55KB
下载 相关 举报
实验三c#实验报告Word格式文档下载.docx_第1页
第1页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第2页
第2页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第3页
第3页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第4页
第4页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第5页
第5页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第6页
第6页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第7页
第7页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第8页
第8页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第9页
第9页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第10页
第10页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第11页
第11页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第12页
第12页 / 共13页
实验三c#实验报告Word格式文档下载.docx_第13页
第13页 / 共13页
亲,该文档总共13页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

实验三c#实验报告Word格式文档下载.docx

《实验三c#实验报告Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《实验三c#实验报告Word格式文档下载.docx(13页珍藏版)》请在冰点文库上搜索。

实验三c#实验报告Word格式文档下载.docx

在时钟的控制下,图片将按照先后次序依次显示在画面上,并配上音乐,每幅画配上相应的文字。

三、实验结果与分析

第二题:

设计思路:

使用TreeView控件,建立一个超市商品分类列表,可以添加、删除各类商品信息。

步骤:

1、按照提示输入类别上商品名称;

分别添加对应的商品种类和商品名称。

2.删除功能:

选中商品,点击删除,可删除选中的商品,选中类别,点击删除,可删除该目录下的全部商品。

3.点击清空可删除所有的目录及商品。

第5题:

1、选择预览图片

2.添加预览图片

3、图片自动播放预览

附录

源代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

namespace实验3._2

{publicpartialclassForm1:

Form

{publicForm1()

{InitializeComponent();

}

privatevoidbutton1_Click(objectsender,EventArgse)

{TreeNodenewnode=newTreeNode(this.textBox1.Text,0,1);

this.treeView1.Nodes.Add(newnode);

this.treeView1.Select();

privatevoidbutton2_Click(objectsender,EventArgse)

{TreeNodeselectednode=this.treeView1.SelectedNode;

if(selectednode==null)

{MessageBox.Show("

请选中节点"

);

return;

if(selectednode.Parent!

=null)

不能添加"

return;

TreeNodenewnode=newTreeNode(this.textBox2.Text,2,3);

selectednode.Nodes.Add(newnode);

selectednode.Expand();

this.treeView1.Select();

privatevoidbutton4_Click(objectsender,EventArgse)

{treeView1.Nodes.Clear();

privatevoidbutton3_Click(objectsender,EventArgse)

{TreeNodeselectnode=this.treeView1.SelectedNode;

if(selectnode==null)

TreeNodeparentnode=selectnode.Parent;

if(parentnode==null)

this.treeView1.Nodes.Remove(selectnode);

else

parentnode.Nodes.Remove(selectnode);

privatevoidForm1_Load(objectsender,EventArgse)

{

}

usingSystem.Collections;

namespace图片自动浏览器

{

///<

summary>

///Form1的摘要说明。

/summary>

publicclassForm1:

System.Windows.Forms.Form

privateSystem.ComponentModel.IContainercomponents;

privateSystem.Windows.Forms.PictureBoxpictureBox1;

privateSystem.Windows.Forms.Buttonbutton1;

privateSystem.Windows.Forms.ListBoxlistBox1;

privateSystem.Windows.Forms.Buttonbutton2;

privateSystem.Windows.Forms.OpenFileDialogopenFileDialog1;

privateSystem.Windows.Forms.Timertimer1;

privateLabellabel1;

privateintPicNo;

//定义数据成员变量PicNo,表示显示图片号

publicForm1()

{

//

//Windows窗体设计器支持所必需的

InitializeComponent();

//TODO:

在InitializeComponent调用后添加任何构造函数代码

}

protectedoverridevoidDispose(booldisposing)

if(disposing)

{

if(components!

=null)

{

components.Dispose();

}

}

base.Dispose(disposing);

#regionWindows窗体设计器生成的代码

privatevoidInitializeComponent()

ponents=newSystem.ComponentModel.Container();

this.pictureBox1=newSystem.Windows.Forms.PictureBox();

this.button1=newSystem.Windows.Forms.Button();

this.listBox1=newSystem.Windows.Forms.ListBox();

this.button2=newSystem.Windows.Forms.Button();

this.openFileDialog1=newSystem.Windows.Forms.OpenFileDialog();

this.timer1=newSystem.Windows.Forms.Timer(ponents);

this.label1=newSystem.Windows.Forms.Label();

((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();

this.SuspendLayout();

//

//pictureBox1

this.pictureBox1.Location=newSystem.Drawing.Point(12,52);

this.pictureBox1.Name="

pictureBox1"

;

this.pictureBox1.Size=newSystem.Drawing.Size(184,216);

this.pictureBox1.SizeMode=System.Windows.Forms.PictureBoxSizeMode.StretchImage;

this.pictureBox1.TabIndex=0;

this.pictureBox1.TabStop=false;

//button1

this.button1.Location=newSystem.Drawing.Point(212,52);

this.button1.Name="

button1"

this.button1.Size=newSystem.Drawing.Size(80,32);

this.button1.TabIndex=1;

this.button1.Text="

选择图片"

this.button1.Click+=newSystem.EventHandler(this.button1_Click);

//listBox1

this.listBox1.ItemHeight=12;

this.listBox1.Location=newSystem.Drawing.Point(212,100);

this.listBox1.Name="

listBox1"

this.listBox1.Size=newSystem.Drawing.Size(168,160);

this.listBox1.TabIndex=2;

//button2

this.button2.Location=newSystem.Drawing.Point(308,52);

this.button2.Name="

button2"

this.button2.Size=newSystem.Drawing.Size(72,32);

this.button2.TabIndex=3;

this.button2.Text="

浏览"

this.button2.Click+=newSystem.EventHandler(this.button2_Click);

//timer1

this.timer1.Interval=1000;

this.timer1.Tick+=newSystem.EventHandler(this.timer1_Tick);

//label1

this.label1.AutoSize=true;

this.label1.Location=newSystem.Drawing.Point(23,18);

this.label1.Name="

label1"

this.label1.Size=newSystem.Drawing.Size(269,12);

this.label1.TabIndex=4;

this.label1.Text="

通过“选择图片”按钮将所需图片添加到列表框中"

//Form1

this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);

this.ClientSize=newSystem.Drawing.Size(403,280);

this.Controls.Add(this.label1);

this.Controls.Add(this.button2);

this.Controls.Add(this.listBox1);

this.Controls.Add(this.button1);

this.Controls.Add(this.pictureBox1);

this.Name="

Form1"

this.Text="

this.Load+=newSystem.EventHandler(this.Form1_Load);

((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();

this.ResumeLayout(false);

this.PerformLayout();

#endregion

[STAThread]

staticvoidMain()

Application.Run(newForm1());

privatevoidForm1_Load(objectsender,System.EventArgse)

PicNo=0;

timer1.Enabled=false;

//设置定时器不可用

privatevoidbutton1_Click(objectsender,System.EventArgse)

//通过“选择图片”按钮将所需图片添加到列表框中

//设置过滤器,只显示图像文件

openFileDialog1.Filter="

位图文件|*.bmp|GIF文件|*.gif|JPEG文件|*.jpg"

//指定缺省过滤器(默认打开JPEG文件)

openFileDialog1.FilterIndex=3;

openFileDialog1.ShowDialog();

//显示“打开”对话框

//将用户选定文件载入列表框

listBox1.Items.Add(openFileDialog1.FileName);

privatevoidbutton2_Click(objectsender,System.EventArgse)

timer1.Enabled=true;

//设置定时器可用

privatevoidtimer1_Tick(objectsender,System.EventArgse)

listBox1.SelectedIndex=PicNo;

strings=listBox1.SelectedItem.ToString();

//得到某一要显示图片的路径

pictureBox1.Image=Image.FromFile(s);

//加载图片

PicNo=PicNo+1;

//为得到下一张图片做准备

if(PicNo>

=listBox1.Items.Count)

//如果是最后一张,则转为第一张

PicNo=0;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 英语考试

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2