生活随笔
收集整理的這篇文章主要介紹了
c#点餐系统源码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
c#餐廳點餐系統源碼:
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
.Windows
.Forms
;namespace 點餐系統
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender
, EventArgs e
){int left
= Screen
.PrimaryScreen
.Bounds
.Width
/ 2 - this.Width
/ 2;int top
= Screen
.PrimaryScreen
.Bounds
.Height
/ 2 - this.Height
/ 2;this.Location
= new Point(left
, top
);foreach (Control control
in flowLayoutPanel1
.Controls
){Button btn
= new Button();btn
.Tag
= control
;foreach (Control item
in control
.Controls
){if (item
.Tag
.ToString()=="index"){btn
.Text
= item
.Text
;}}btn
.Size
= new Size(50, 30);btn
.Font
= new Font("", 15);flowLayoutPanel14
.Controls
.Add(btn
);btn
.Click
+= Btn_Click
;}}int count
= 0;private void Btn_Click(object sender
, EventArgs e
){ Button clickbtn
= (Button
)sender
;Control menu
= (Control
)clickbtn
.Tag
;Label label
= new Label();foreach (Control item
in menu
.Controls
){if (item
.Tag
.ToString()=="name"){label
.Text
= item
.Text
;}if (item
.Tag
.ToString()=="money"){count
+= int.Parse(item
.Text
);
}}label
.Font
= new Font("",15);flowLayoutPanel15
.Controls
.Add(label
);label39
.Text
= count
+ "¥";}}
}
運行結果
總結
以上是生活随笔為你收集整理的c#点餐系统源码的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。