实验三c#实验报告资料

上传人:今*** 文档编号:108300679 上传时间:2019-10-23 格式:DOC 页数:10 大小:338KB
返回 下载 相关 举报
实验三c#实验报告资料_第1页
第1页 / 共10页
实验三c#实验报告资料_第2页
第2页 / 共10页
实验三c#实验报告资料_第3页
第3页 / 共10页
实验三c#实验报告资料_第4页
第4页 / 共10页
实验三c#实验报告资料_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《实验三c#实验报告资料》由会员分享,可在线阅读,更多相关《实验三c#实验报告资料(10页珍藏版)》请在金锄头文库上搜索。

1、上海应用技术学院“C#”课程实验报告实验名称实验三 控件应用2实验序号二姓 名实验日期一、实验目的和要求1掌握ListView、TreeView控件的使用。2掌握菜单、工具栏、状态栏控件的使用。3掌握文件、颜色、字体等通用对话框的使用。4掌握多窗体应用程序的创建。二、实验项目摘要1设计一个选课界面程序,将课程详细信息显示在表格中,请使用ListView控件设计表格。其中课程信息包括课程编号,课程名称、课程学时和授课教师等。用户可选择多门课程,单击“选课”按钮,将所选的课程信息显示在另一个窗体上。2使用TreeView控件,建立一个超市商品分类列表,可以添加、删除各类商品信息。3设计一个字符串处

2、理应用程序。要求利用菜单和工具栏完成各种字符串处理任务,如字符串比较、查找、求字串、拆分、合并等。利用状态栏显示当前的操作。4制作一个文档编辑器程序,可以进行文档的打开和保存、基本的编辑操作以及颜色和字体的设置等。5电子相册制作。在时钟的控制下,图片将按照先后次序依次显示在画面上,并配上音乐,每幅画配上相应的文字。三、实验结果与分析 第二题:设计思路:使用TreeView控件,建立一个超市商品分类列表,可以添加、删除各类商品信息。步骤:1、按照提示输入类别上商品名称;分别添加对应的商品种类和商品名称。2.删除功能:选中商品,点击删除,可删除选中的商品,选中类别,点击删除,可删除该目录下的全部商

3、品。3.点击清空可删除所有的目录及商品。第5题:设计思路:在时钟的控制下,图片将按照先后次序依次显示在画面上,并配上音乐,每幅画配上相应的文字。1、选择预览图片2.添加预览图片3、图片自动播放预览附录源代码:第二题:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace 实验3._2

4、 public partial class Form1 : Form public Form1() InitializeComponent(); private void button1_Click(object sender, EventArgs e) TreeNode newnode = new TreeNode(this.textBox1.Text, 0, 1); this.treeView1.Nodes.Add(newnode); this.treeView1.Select(); private void button2_Click(object sender, EventArgs e

5、) TreeNode selectednode = this.treeView1.SelectedNode; if(selectednode =null ) MessageBox.Show(请选中节点); return ; if (selectednode.Parent != null) MessageBox.Show(不能添加); return; TreeNode newnode=new TreeNode (this.textBox2 .Text ,2,3); selectednode .Nodes .Add (newnode ); selectednode .Expand (); this

6、.treeView1 .Select (); private void button4_Click(object sender, EventArgs e) treeView1.Nodes.Clear(); private void button3_Click(object sender, EventArgs e) TreeNode selectnode = this.treeView1.SelectedNode; if (selectnode = null) MessageBox.Show(请选中节点); return; TreeNode parentnode = selectnode.Par

7、ent; if (parentnode = null) this.treeView1.Nodes.Remove(selectnode); else parentnode.Nodes.Remove(selectnode); this.treeView1.Select(); private void Form1_Load(object sender, EventArgs e) 第5题:using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.

8、Forms;using System.Data;namespace 图片自动浏览器/ / Form1 的摘要说明。/ public class Form1 : System.Windows.Forms.Formprivate System.ComponentModel.IContainer components;private System.Windows.Forms.PictureBox pictureBox1;private System.Windows.Forms.Button button1;private System.Windows.Forms.ListBox listBox1;p

9、rivate System.Windows.Forms.Button button2;private System.Windows.Forms.OpenFileDialog openFileDialog1;private System.Windows.Forms.Timer timer1; private Label label1;private int PicNo; /定义数据成员变量PicNo,表示显示图片号public Form1()/ Windows 窗体设计器支持所必需的/InitializeComponent();/ TODO: 在InitializeComponent 调用后添加

10、任何构造函数代码/protected override void Dispose( bool disposing )if( disposing )if (components != null) components.Dispose();base.Dispose( disposing );#region Windows 窗体设计器生成的代码private void InitializeComponent() ponents = new System.ComponentModel.Container(); this.pictureBox1 = new System.Windows.Forms.Pi

11、ctureBox(); this.button1 = new System.Windows.Forms.Button(); this.listBox1 = new System.Windows.Forms.ListBox(); this.button2 = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.timer1 = new System.Windows.Forms.Timer(ponents); this.label1 = n

12、ew System.Windows.Forms.Label(); (System.ComponentModel.ISupportInitialize)(this.pictureBox1).BeginInit(); this.SuspendLayout(); / / pictureBox1 / this.pictureBox1.Location = new System.Drawing.Point(12, 52); this.pictureBox1.Name = pictureBox1; this.pictureBox1.Size = new System.Drawing.Size(184, 216); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号