C#窗体程序简单制作(简单购物系统/网购系统)

C#窗体程序简单制作(简单购物系统/网购系统)

源码:
链接:https://pan.baidu.com/s/1-q1vWjAs0aNGrGlZcUVUAw
提取码:a5pi

1.C#程序执行结果

在这里插入图片描述

2.程序思路:

(简单模拟)
1.点击加入购物车; 2.选择商品购买数量; 3.必须指定定物流方式;4.点击按钮。

3.C#代码

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace _8_10_网购系统
{
	/// <summary>
	/// Description of MainForm.
	/// </summary>
	public partial class MainForm : Form
	{
		public int a,b,c,d;   // 第一操作数(存储数字微调框的数字)
		public float f; // 运算符
		
		public MainForm()
		{
			InitializeComponent();
		}
		
		void Button1Click(object sender, EventArgs e)
		{
		   a = Convert.ToInt32(numericUpDown1.Value.ToString());   // 数字微调框的数字
           b = Convert.ToInt32(numericUpDown2.Value.ToString());   // 数字微调框的数字
           c = Convert.ToInt32(numericUpDown3.Value.ToString());   // 数字微调框的数字
           d = Convert.ToInt32(numericUpDown4.Value.ToString());   // 数字微调框的数字
           f = (199 * a + 119 * b + 259 * c + 139 * d);

            if (comboBox1.SelectedIndex == -1)
            {
            	MessageBox.Show("请指定物流方式!");
            }
            else
            {
            MessageBox.Show("本次购物一共"+f.ToString()+"元"+","+"使用的快递为"+comboBox1.Text+"。");
            }
		}
		
		void CheckBox1CheckedChanged(object sender, EventArgs e)   // 加入购物车 1
		{
			if (checkBox1.Checked)   { numericUpDown1.Enabled = true;}
			else { numericUpDown1.Enabled = false;}
		}
		
		void CheckBox2CheckedChanged(object sender, EventArgs e)
		{
			if (checkBox2.Checked)   { numericUpDown2.Enabled = true;}
			else { numericUpDown2.Enabled = false;}
		}
		
		void CheckBox3CheckedChanged(object sender, EventArgs e)
		{
			if (checkBox3.Checked)   { numericUpDown3.Enabled = true;}
			else { numericUpDown3.Enabled = false;}
		}
		
		void CheckBox4CheckedChanged(object sender, EventArgs e)
		{
			if (checkBox4.Checked)   { numericUpDown4.Enabled = true;}
			else { numericUpDown4.Enabled = false;}
		}
	}
}

评论 22
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

rsZheng4916

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值