我已将以下轨迹栏控件添加到标签页“tab1”中:
TrackBar[] tbs = new TrackBar[nooftbsneeded];
// Add TrackBars
TrackBar tbx = new TrackBar();
tbx.Location = new Point(28, 150 + (i * 200));
tbx.Size = new Size(686, 45);
tbx.Minimum = 0;
tbx.Maximum = 16;
tbx.SmallChange = 1;
tbx.LargeChange = 2;
tbx.Value = 8;
// create events (using a lambda expression) for each trackbar to change values.
tbx.Scroll += (o, a) =>
{
// Update text values
if (tbx.Value == 0)
{
label3x.Text = "Extremely Better";
label4x.Text = "";
}
if (tbx.Value == 1)
{
label3x.Text = "Extremely Better";
label4x.Text = "";
}
if (tbx.Value == 2)
{
label3x.Text = "Very Strongly Better";
label4x.Text = "";
}
if (tbx.Value == 3)
{
label3x.Text = "Very Strongly Better";
label4x.Text = "";
}
if (tbx.Value == 4)
{
label3x.Text = "Strongly Better";
label4x.Text = "";
}
if (tbx.Value == 5)
{
label3x.Text = "Strongly Better";
label4x.Text = "";
}
if (tbx.Value == 6)
{
label3x.Text = "Moderately Better";
label4x.Text = "";
}
if (tbx.Value == 7)
{
label3x.Text = "Moderately Better";
label4x.Text = "";
}
if (tbx.Value == 8)
{
label3x.Text = "Equal";
label4x.Text = "Equal";
}
if (tbx.Value == 9)
{
label3x.Text = "";
label4x.Text = "Moderately Better";
}
if (tbx.Value == 10)
{
label3x.Text = "";
label4x.Text = "Moderately Better";
}
if (tbx.Value == 11)
{
label3x.Text = "";
label4x.Text = "Strongly Better";
}
if (tbx.Value == 12)
{
label3x.Text = "";
label4x.Text = "Strongly Better";
}
if (tbx.Value == 13)
{
label3x.Text = "";
label4x.Text = "Very Strongly Better";
}
if (tbx.Value == 14)
{
label3x.Text = "";
label4x.Text = "Very Strongly Better";
}
if (tbx.Value == 15)
{
label3x.Text = "";
label4x.Text = "Extremely Better";
}
if (tbx.Value == 16)
{
label3x.Text = "";
label4x.Text = "Extremely Better";
}
};
tbs[i] = tbx;
tab1.Controls.Add(tbs[i]);
我现在如何获取轨迹栏的各个值?
我已经尝试了我能想到的所有调用组合。我只是不知道如何引用单独的轨迹栏控件。