花店售卖系统主要是为了熟悉CS结构开发,和C#中一些方法的使用,并不设计实用,故逻辑并不严谨,了解用法即可。
主界面采用的也是控件的组合:
采用panel对主界面进行划分
左侧写入menu控件,作为菜单用
右侧写入pictureBox、Label、textBox控件组合成鲜花的展览界面
代码:
1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms; 10 11 namespace BS结构用户界面 12 { 13 public partial class main : Form 14 { 15 public main() 16 { 17 InitializeComponent(); 18 } 19 20 private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e) 21 { 22 23 } 24 25 private void 鲜花总览_Click(object sender, EventArgs e) 26 { 27 28 } 29 30 private void 功能菜单_ItemClicked(object sender, ToolStripItemClickedEventArgs e) 31 { 32 33 } 34 35 private void 退出系统ToolStripMenuItem_Click(object sender, EventArgs e) 36 { 37 38 } 39 40 private void label1_Click(object sender, EventArgs e) 41 { 42 43 } 44 45 private void label2_Click(object sender, EventArgs e) 46 { 47 48 } 49 50 private void button4_Click(object sender, EventArgs e) 51 { 52 Image TP = this.pictureBox4.BackgroundImage; 53 string HM = this.label4.Text; 54 string JG = this.label12.Text; 55 buy b = new buy(TP, HM, JG); 56 b.ShowDialog(); 57 } 58 59 private void 配送服务ToolStripMenuItem_Click(object sender, EventArgs e) 60 { 61 send s = new send(); 62 s.ShowDialog(); 63 } 64 65 private void menuStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e) 66 { 67 68 } 69 70 private void Tcxt_Click_1(object sender, EventArgs e) 71 { 72 System.Environment.Exit(0); 73 } 74 75 private void button1_Click(object sender, EventArgs e) 76 { 77 Image TP = this.pictureBox1.BackgroundImage; 78 string HM = this.label1.Text; 79 string JG = this.label9.Text; 80 buy b = new buy(TP,HM,JG); 81 b.ShowDialog(); 82 83 } 84 85 private void label9_Click(object sender, EventArgs e) 86 { 87 88 } 89 90 private void button2_Click(object sender, EventArgs e) 91 { 92 Image TP = this.pictureBox2.BackgroundImage; 93 string HM = this.label2.Text; 94 string JG = this.label10.Text; 95 buy b = new buy(TP, HM, JG); 96 b.ShowDialog(); 97 } 98 99 private void button3_Click(object sender, EventArgs e) 100 { 101 Image TP = this.pictureBox3.BackgroundImage; 102 string HM = this.label3.Text; 103 string JG = this.label10.Text; 104 buy b = new buy(TP, HM, JG); 105 b.ShowDialog(); 106 } 107 108 private void button5_Click(object sender, EventArgs e) 109 { 110 Image TP = this.pictureBox5.BackgroundImage; 111 string HM = this.label5.Text; 112 string JG = this.label13.Text; 113 buy b = new buy(TP, HM, JG); 114 b.ShowDialog(); 115 } 116 117 private void button6_Click(object sender, EventArgs e) 118 { 119 Image TP = this.pictureBox6.BackgroundImage; 120 string HM = this.label6.Text; 121 string JG = this.label16.Text; 122 buy b = new buy(TP, HM, JG); 123 b.ShowDialog(); 124 } 125 126 private void button7_Click(object sender, EventArgs e) 127 { 128 Image TP = this.pictureBox7.BackgroundImage; 129 string HM = this.label7.Text; 130 string JG = this.label15.Text; 131 buy b = new buy(TP, HM, JG); 132 b.ShowDialog(); 133 } 134 135 private void button8_Click(object sender, EventArgs e) 136 { 137 Image TP = this.pictureBox8.BackgroundImage; 138 string HM = this.label8.Text; 139 string JG = this.label14.Text; 140 buy b = new buy(TP, HM, JG); 141 b.ShowDialog(); 142 } 143 144 private void label18_Click(object sender, EventArgs e) 145 { 146 147 } 148 149 private void Xhzl_Click(object sender, EventArgs e) 150 { 151 152 } 153 } 154 }
效果:
点击配送服务,弹出对话框:
点击购买,弹出对应的购买对话框: