这里写自定义目录标题
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 WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button6_Click(object sender, EventArgs e)
{
for (int i = 0; i < checkedListBox1.Items.Count; i++)
checkedListBox1.SetItemChecked(i, true);
}
private void button7_Click(object sender, EventArgs e)
{
for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
if (checkedListBox1.GetItemChecked(i) == true)
checkedListBox1.Items.RemoveAt(i);
}
}
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
switch(checkedListBox1.SelectedIndex)
{
case 0:
comboBox2.Items.Clear();
comboBox2.Items.Add("39码");
comboBox2.Items.Add("40码");
comboBox2.Items.Add("41码");
comboBox2.Items.Add("42码");
comboBox2.Items.Add("43码");
comboBox2.SelectedIndex = 0;
break;
case 1:
comboBox2.Items.Clear();
comboBox2.Items.Add("500g");
comboBox2.Items.Add("1L");
comboBox2.Items.Add("1.5L");
comboBox2.Items.Add("2L");
comboBox2.SelectedIndex = 0;
break;
case 2:
comboBox2.Items.Clear();
comboBox2.Items.Add("GWH-1000F-2ADR");
comboBox2.Items.Add("GWH-1000NV-2ADR");
comboBox2.Items.Add("GWH-1000-9ADR");
comboBox2.Items.Add("GWH-1000-2APR");
comboBox2.SelectedIndex = 0;
break;
case 3:
comboBox2.Items.Clear();
comboBox2.Items.Add("GeForce RTX 2080Ti HOF");
comboBox2.Items.Add("GeForce RTX 2080Ti PLUS");
comboBox2.SelectedIndex = 0;
break;
case 4:
comboBox2.Items.Clear();
comboBox2.Items.Add("黑色");
comboBox2.Items.Add("白色");
comboBox2.Items.Add("棕色");
comboBox2.SelectedIndex = 0;
break;
default:
comboBox2.Items.Clear();
break;
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Single r;
r = 7 + 8;
textBox1.Text = r.ToString();
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox1.Items.Clear();
comboBox1.Text = "";
if(comboBox2.SelectedItem== "GWH-1000NV-2ADR")
{
comboBox1.Items.Add("3490");
}
if (comboBox2.SelectedItem == "GWH-1000-9ADR")
{
comboBox1.Items.Add("4490");
}
if (comboBox2.SelectedItem == "39码")
{
comboBox1.Items.Add("789");
}
if (comboBox2.SelectedItem == "40码")
{
comboBox1.Items.Add("789");
}
if (comboBox2.SelectedItem == "41码")
{
comboBox1.Items.Add("789");
}
if (comboBox2.SelectedItem == "42码")
{
comboBox1.Items.Add("789");
}
if (comboBox2.SelectedItem == "43码")
{
comboBox1.Items.Add("789");
}
if (comboBox2.SelectedItem == "500g")
{
comboBox1.Items.Add("56");
}
if (comboBox2.SelectedItem == "1L")
{
comboBox1.Items.Add("112");
}
if (comboBox2.SelectedItem == "1.5L")
{
comboBox1.Items.Add("168");
}
if (comboBox2.SelectedItem == "2L")
{
comboBox1.Items.Add("224");
}
if (comboBox2.SelectedItem == "GWH-1000F-2ADR")
{
comboBox1.Items.Add("4990");
}
if (comboBox2.SelectedItem == "GWH-1000-2APR")
{
comboBox1.Items.Add("4990");
}
if (comboBox2.SelectedItem == "GeForce RTX 2080Ti HOF")
{
comboBox1.Items.Add("12799");
}
if (comboBox2.SelectedItem == "GeForce RTX 2080Ti PLUS")
{
comboBox1.Items.Add("12899");
}
if (comboBox2.SelectedItem == "黑色")
{
comboBox1.Items.Add("999");
}
if (comboBox2.SelectedItem == "白色")
{
comboBox1.Items.Add("999");
}
if (comboBox2.SelectedItem == "棕色")
{
comboBox1.Items.Add("999");
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
请问这个checkedListBox选中的项目的价格怎么相加![在这里插入图片描述](https://img-blog.csdnimg.cn/20190520133007650.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2tldGVyXzQy,size_16,color_FFFFFF,t_70)