可視化程序設(shè)計(jì)-個(gè)人記賬本(課程設(shè)計(jì))_第1頁(yè)
可視化程序設(shè)計(jì)-個(gè)人記賬本(課程設(shè)計(jì))_第2頁(yè)
可視化程序設(shè)計(jì)-個(gè)人記賬本(課程設(shè)計(jì))_第3頁(yè)
可視化程序設(shè)計(jì)-個(gè)人記賬本(課程設(shè)計(jì))_第4頁(yè)
可視化程序設(shè)計(jì)-個(gè)人記賬本(課程設(shè)計(jì))_第5頁(yè)
已閱讀5頁(yè),還剩10頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、可視化程序設(shè)計(jì)實(shí)驗(yàn)報(bào)告學(xué) 號(hào):2143214姓 名:李子厚提交日期:2016-11-1成 績(jī):東北大學(xué)秦皇島分校可視化程序設(shè)計(jì) 實(shí)驗(yàn)報(bào)告實(shí)驗(yàn)一 控件和窗體【實(shí)驗(yàn)內(nèi)容】做一個(gè)簡(jiǎn)單的小計(jì)算器,實(shí)現(xiàn)整數(shù)的加減法【關(guān)鍵代碼】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 Window

2、sFormsApplication1 public partial class Form1 : Form double outValue = 0; bool c = false; string d; bool f = true; int x = 0; int y = 0; public Form1() InitializeComponent(); private void button1_Click(object sender, EventArgs e) caculate(1); private void button2_Click(object sender, EventArgs e) ca

3、culate(2); private void button3_Click(object sender, EventArgs e) caculate(3); private void button4_Click(object sender, EventArgs e) caculate(4); private void button5_Click(object sender, EventArgs e) caculate(5); private void button6_Click(object sender, EventArgs e) caculate(6); private void butt

4、on7_Click(object sender, EventArgs e) caculate(7); private void button8_Click(object sender, EventArgs e) caculate(8); private void button9_Click(object sender, EventArgs e) caculate(9); private void button14_Click(object sender, EventArgs e) caculate(0); private void button10_Click(object sender, E

5、ventArgs e) c = true; d = "+" textBox1.Text += "+" private void button11_Click(object sender, EventArgs e) c = true; d = "-" textBox1.Text += "-" private void button12_Click(object sender, EventArgs e) switch (d) case "+": outValue = x + y; break; ca

6、se "-": outValue = x - y; break; case "*": outValue = x * y; break; case "/": outValue = x /y; break; textBox1.Text = outValue + "" c = false; f = false; x = 0; y = 0; private void button13_Click(object sender, EventArgs e) textBox1.Text = "" c = fal

7、se; f = false; x = 0; y = 0; public void caculate(int z) if (f = false) textBox1.Text = "" f = true; if (c = true) textBox1.Text += z; y = 10 * y + z; else textBox1.Text += z; x = 10 * x + z; private void button15_Click(object sender, EventArgs e) if (c = true) y = 0; textBox1.Text = x + d

8、; else x = 0; textBox1.Text = "" private void button17_Click(object sender, EventArgs e) c = true; d = "*" textBox1.Text += "*" private void button16_Click(object sender, EventArgs e) c = true; d = "/" textBox1.Text += "/" private void button18_Click

9、(object sender, EventArgs e) /除法功能只能算整除,由于不知道int換成double怎么改所以沒(méi)能實(shí)現(xiàn)【程序截圖】實(shí)驗(yàn)二 目錄與文件【實(shí)驗(yàn)內(nèi)容】做一個(gè)簡(jiǎn)單的記事本,有打開和保存功能【關(guān)鍵代碼】using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System

10、.Windows.Forms;using System.IO;namespace test2 public partial class Form1 : Form public Form1() InitializeComponent(); string filename; private void 打開ToolStripMenuItem_Click(object sender, EventArgs e) OpenFileDialog open = new OpenFileDialog(); filename = open.FileName; open.Filter = "txt fil

11、es (*.txt)|*.txt|All files (*.*)|*.*" open.FilterIndex = 2; open.RestoreDirectory = true; if (open.ShowDialog()=DialogResult.OK) StreamReader reader = new StreamReader(open.FileName, System.Text.Encoding.Default); richTextBox1.Text = reader.ReadToEnd(); reader.Close(); private void 保存ToolStripM

12、enuItem_Click(object sender, EventArgs e) SaveFileDialog save = new SaveFileDialog(); StreamWriter writer; save.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" save.FilterIndex = 2; save.RestoreDirectory = true; if (save.ShowDialog() = DialogResult.OK) writer = new StreamWriter(save

13、.FileName); writer.Write(richTextBox1.Text); /寫入 writer.Close();/關(guān)閉流 【程序截圖】實(shí)驗(yàn)三 圖形圖像處理【實(shí)驗(yàn)內(nèi)容】做一個(gè)程序,可以讀取一個(gè)位圖并顯示,通過(guò)點(diǎn)擊上下左右按鈕,可以調(diào)整圖片的位置,通過(guò)點(diǎn)擊放大縮小,可以縮放圖片?!娟P(guān)鍵代碼】using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text

14、;using System.Windows.Forms;namespace WindowsFormsApplication3 public partial class Form1 : Form Graphics g; int width, height; int x, y; const int per = 5; float rit = 1; public Form1() InitializeComponent(); width = pictureBox1.Width; height = pictureBox1.Height; g = this.pictureBox1.CreateGraphic

15、s(); x = y = 0; private void draw() g = this.pictureBox1.CreateGraphics(); g.Clear(this.BackColor); g.TranslateTransform(x, y); g.ScaleTransform(rit, rit); g.DrawImage(pictureBox1.Image, 0, 0, width, height); private void 讀取ToolStripMenuItem_Click(object sender, EventArgs e) OpenFileDialog open = ne

16、w OpenFileDialog(); open.Filter = "image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*" if (open.ShowDialog() = DialogResult.OK) pictureBox1.Image = Image.FromFile(open.FileName); private void pictureBox1_Click(object sender, EventArgs e) private void button1_Click(object

17、sender, EventArgs e) y = y - per; draw(); private void button2_Click(object sender, EventArgs e) y = y + per; draw(); private void button3_Click(object sender, EventArgs e) x = x - per; draw(); private void button4_Click(object sender, EventArgs e) x = x + per; draw(); private void button5_Click(obj

18、ect sender, EventArgs e) rit = (float)(rit + 0.1); draw(); private void button6_Click(object sender, EventArgs e) if (rit > 0) rit = (float)(rit - 0.1); draw(); 【程序截圖】 實(shí)驗(yàn)四 數(shù)據(jù)操作【實(shí)驗(yàn)內(nèi)容】制作一個(gè)程序,輸入一個(gè)姓名,點(diǎn)擊查詢?!娟P(guān)鍵代碼】using System;using System.Collections.Generic;using System.ComponentModel;using System.Dat

19、a;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace DBOperate public partial class Form1 : Form SqlDataAdapter adapter; DataTable table; DataSet dataset1; public Form1() InitializeComponent(); privat

20、e void Form1_Load(object sender, EventArgs e) string connStr = Properties.Settings.Default.Database2ConnectionString;/連接字符串 SqlConnection conn = new SqlConnection(connStr);/建立到數(shù)據(jù)庫(kù)的連接 adapter = new SqlDataAdapter("select * from Table", conn); SqlCommandBuilder builder = new SqlCommandBuilde

21、r(adapter); adapter.InsertCommand = builder.GetInsertCommand(); adapter.DeleteCommand = builder.GetDeleteCommand(); adapter.UpdateCommand = builder.GetUpdateCommand(); table = new DataTable(); adapter.Fill(table); dataGridView1.DataSource = table; private void button2_Click(object sender, EventArgs

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論