我正在尝试将pip install --force-reinstall Pillow==5.0.0
中的组合框项目(数字)显示在Form1
中的图表中,但我无法在图表中显示该值。经过多次尝试,这就是我现在所处的位置,但我无法弄清楚如何让它发挥作用。
Form2
中的代码:
Form2
当我点击private void button1_Click(object sender, EventArgs e)
{
Form1 frm1 = new Form1();
for (int i = 0; i < frm1.comboBox1.Items.Count; i++)
{
int Value = Convert.ToInt16(frm1.comboBox1.Items);
chart1.Series["Saved Results"].Points.AddXY(0, Value);
}
}
时,没有任何反应:(。你可以帮帮我吗?谢谢!
答案 0 :(得分:2)
您正在将项目集合转换为Int16,这可能没什么。使用项目集合上的索引器。
private void button1_Click(object sender, EventArgs e)
{
Form1 frm1 = new Form1();
for (int i = 0; i < frm1.comboBox1.Items.Count; i++)
{
int Value = Convert.ToInt16(frm1.comboBox1.Items[i]);
chart1.Series["Saved Results"].Points.AddXY(0, Value);
}
}