所以我尝试将坐标从文本框加载到双倍列表中。我已经编辑了他们的TabIndex,所以它们是有序的,但当我尝试加载数字时,它正在读取一些奇怪的odrer中的文本框。2->4->8->7->5->6->3->有人能帮我吗?sur\u x和sur\u y是列表的名称。
public Boolean Nacitanie_hodnot()
{
// premazanie listov a vlozenie prvej hodnoty
sur_x.Clear();
sur_y.Clear();
sur_x.Add(0);
sur_y.Add(0);
int i = 1;
// nacitanie hodnot
/*Ax = double.Parse(suradnica_Ax.Text, CultureInfo.InvariantCulture.NumberFormat);
Ay = double.Parse(suradnica_Ay.Text, CultureInfo.InvariantCulture.NumberFormat);
Bx = double.Parse(suradnica_Bx.Text, CultureInfo.InvariantCulture.NumberFormat);
By = double.Parse(suradnica_By.Text, CultureInfo.InvariantCulture.NumberFormat);
Cx = double.Parse(suradnica_Cx.Text, CultureInfo.InvariantCulture.NumberFormat);
Cy = double.Parse(suradnica_Cy.Text, CultureInfo.InvariantCulture.NumberFormat);
Dx = double.Parse(suradnica_Dx.Text, CultureInfo.InvariantCulture.NumberFormat);
Dy = double.Parse(suradnica_Dy.Text, CultureInfo.InvariantCulture.NumberFormat);*/
foreach (Control control in suradnice_vrcholov.Controls)
{
if ((control is TextBox) && (control.Text == "Zadaj"))
{
return false;
}
else if ((control is TextBox) && ((i % 2) != 0))
{
sur_x.Add(double.Parse(control.Text, CultureInfo.InvariantCulture.NumberFormat));
i++;
}
else if ((control is TextBox) && ((i % 2) == 0))
{
sur_y.Add(double.Parse(control.Text, CultureInfo.InvariantCulture.NumberFormat));
i++;
}
}
return true;
}