版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、上海應(yīng)用技術(shù)學(xué)院“C#”課程實(shí)驗(yàn)報(bào)告實(shí)驗(yàn)名稱實(shí)驗(yàn)三 控件應(yīng)用2實(shí)驗(yàn)序號(hào)二姓 名實(shí)驗(yàn)日期一、實(shí)驗(yàn)?zāi)康暮鸵?掌握ListView、TreeView控件的使用。2掌握菜單、工具欄、狀態(tài)欄控件的使用。3掌握文件、顏色、字體等通用對(duì)話框的使用。4掌握多窗體應(yīng)用程序的創(chuàng)建。二、實(shí)驗(yàn)項(xiàng)目摘要1設(shè)計(jì)一個(gè)選課界面程序,將課程詳細(xì)信息顯示在表格中,請(qǐng)使用ListView控件設(shè)計(jì)表格。其中課程信息包括課程編號(hào),課程名稱、課程學(xué)時(shí)和授課教師等。用戶可選擇多門課程,單擊“選課”按鈕,將所選的課程信息顯示在另一個(gè)窗體上。2使用TreeView控件,建立一個(gè)超市商品分類列表,可以添加、刪除各類商品信息。3設(shè)計(jì)一個(gè)字符串處
2、理應(yīng)用程序。要求利用菜單和工具欄完成各種字符串處理任務(wù),如字符串比較、查找、求字串、拆分、合并等。利用狀態(tài)欄顯示當(dāng)前的操作。4制作一個(gè)文檔編輯器程序,可以進(jìn)行文檔的打開和保存、基本的編輯操作以及顏色和字體的設(shè)置等。5電子相冊(cè)制作。在時(shí)鐘的控制下,圖片將按照先后次序依次顯示在畫面上,并配上音樂,每幅畫配上相應(yīng)的文字。三、實(shí)驗(yàn)結(jié)果與分析 第二題:設(shè)計(jì)思路:使用TreeView控件,建立一個(gè)超市商品分類列表,可以添加、刪除各類商品信息。步驟:1、按照提示輸入類別上商品名稱;分別添加對(duì)應(yīng)的商品種類和商品名稱。2.刪除功能:選中商品,點(diǎn)擊刪除,可刪除選中的商品,選中類別,點(diǎn)擊刪除,可刪除該目錄下的全部商
3、品。3.點(diǎn)擊清空可刪除所有的目錄及商品。第5題:設(shè)計(jì)思路:在時(shí)鐘的控制下,圖片將按照先后次序依次顯示在畫面上,并配上音樂,每幅畫配上相應(yīng)的文字。1、選擇預(yù)覽圖片2.添加預(yù)覽圖片3、圖片自動(dòng)播放預(yù)覽附錄源代碼:第二題: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 實(shí)驗(yàn)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("請(qǐng)選中節(jié)點(diǎn)"); return ; if (selectednode.Parent != null) MessageBox.Show("不能添加"); return; TreeNode newnode=new TreeNode (this.textBox2 .Text ,2,3); selectednode .Nodes .Add (newnode ); selec
6、tednode .Expand (); this.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("請(qǐng)選中節(jié)點(diǎn)"); return;
7、TreeNode parentnode = selectnode.Parent; 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.
8、ComponentModel;using System.Windows.Forms;using System.Data;namespace 圖片自動(dòng)瀏覽器/ <summary>/ Form1 的摘要說明。/ </summary>public class Form1 : System.Windows.Forms.Formprivate System.ComponentModel.IContainer components;private System.Windows.Forms.PictureBox pictureBox1;private System.Windows.F
9、orms.Button button1;private System.Windows.Forms.ListBox listBox1;private System.Windows.Forms.Button button2;private System.Windows.Forms.OpenFileDialog openFileDialog1;private System.Windows.Forms.Timer timer1; private Label label1;private int PicNo; /定義數(shù)據(jù)成員變量PicNo,表示顯示圖片號(hào)public Form1()/ Windows 窗
10、體設(shè)計(jì)器支持所必需的/InitializeComponent();/ TODO: 在InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼/protected override void Dispose( bool disposing )if( disposing )if (components != null) components.Dispose();base.Dispose( disposing );#region Windows 窗體設(shè)計(jì)器生成的代碼private void InitializeComponent() ponents = new System.Compone
11、ntModel.Container(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); 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(); thi
12、s.timer1 = new System.Windows.Forms.Timer(ponents); this.label1 = new 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 =
13、"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; / / button1 / this.button1.Location = new System.Drawing.Point(212, 52
14、); this.button1.Name = "button1" this.button1.Size = new System.Drawing.Size(80, 32); this.button1.TabIndex = 1; this.button1.Text = "選擇圖片" this.button1.Click += new System.EventHandler(this.button1_Click); / / listBox1 / this.listBox1.ItemHeight = 12; this.listBox1.Location = ne
15、w System.Drawing.Point(212, 100); this.listBox1.Name = "listBox1" this.listBox1.Size = new System.Drawing.Size(168, 160); this.listBox1.TabIndex = 2; / / button2 / this.button2.Location = new System.Drawing.Point(308, 52); this.button2.Name = "button2" this.button2.Size = new Sys
16、tem.Drawing.Size(72, 32); this.button2.TabIndex = 3; this.button2.Text = "瀏覽" this.button2.Click += new System.EventHandler(this.button2_Click); / / timer1 / this.timer1.Interval = 1000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); / / label1 / this.label1.AutoSize = true
17、; this.label1.Location = new System.Drawing.Point(23, 18); this.label1.Name = "label1" this.label1.Size = new System.Drawing.Size(269, 12); this.label1.TabIndex = 4; this.label1.Text = "通過“選擇圖片”按鈕將所需圖片添加到列表框中" / / Form1 / this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); t
18、his.ClientSize = new System.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 = "Form1" this.Load += new Sy
19、stem.EventHandler(this.Form1_Load); (System.ComponentModel.ISupportInitialize)(this.pictureBox1).EndInit(); this.ResumeLayout(false); this.PerformLayout();#endregionSTAThreadstatic void Main() Application.Run(new Form1();private void Form1_Load(object sender, System.EventArgs e) PicNo = 0; timer1.Enabled = false;/ 設(shè)置定時(shí)器不可用private void button1_Click(object sender, System.EventArgs e) /通過“選擇圖片”按鈕將所需圖片添加到列表框中/設(shè)置過濾
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年財(cái)務(wù)會(huì)計(jì)制度執(zhí)行與審計(jì)手冊(cè)
- 高職學(xué)生創(chuàng)新能力培養(yǎng)方案設(shè)計(jì)
- 2026年智能眼鏡輔助駕駛報(bào)告及未來五至十年智能交通報(bào)告
- 維修改造項(xiàng)目監(jiān)理方案與流程
- 擋墻護(hù)欄施工方案(3篇)
- 支護(hù)漏水應(yīng)急預(yù)案(3篇)
- 樓梯施工方案定制(3篇)
- 施工方案的模板(3篇)
- 拜訪車主活動(dòng)方案策劃(3篇)
- 成都汽車活動(dòng)策劃方案(3篇)
- 初中寒假計(jì)劃課件
- 2024-2025學(xué)年江蘇省南京市玄武區(qū)八年級(jí)上學(xué)期期末語文試題及答案
- 專升本語文教學(xué)課件
- 別人買房子給我合同范本
- 電力通信培訓(xùn)課件
- 中建三局2024年項(xiàng)目經(jīng)理思維導(dǎo)圖
- 基層黨建知識(shí)測(cè)試題及答案
- DG-TJ08-2021-2025 干混砌筑砂漿抗壓強(qiáng)度現(xiàn)場(chǎng)檢測(cè)技術(shù)標(biāo)準(zhǔn)
- 鼻竇炎的護(hù)理講課課件
- 腸系膜脂膜炎CT診斷
- 體外膜肺氧合技術(shù)ECMO培訓(xùn)課件
評(píng)論
0/150
提交評(píng)論