跟踪栏指向checkedlistbox中的相同项目 [英] Trackbar point to equal items in a checkedlistbox
问题描述
我有一个checklistbox和一个trackbar,我希望跟踪器点数根据checklistbox中的项目数量而变化。即
如果核对表有5个项目,我希望轨迹栏也只有5个点(最高点)。
这是可能的,我试图通过列表框和清单箱来实现这一点,但两者都无效.... br $> b $ b
trackBar1.Maximum = checkedlistbox1.Items.Count;
我尝试过:
trackbar1.Value = checkedlistboox.Items.Count.ToString();
I have a checklistbox and a trackbar, I want the trackers points to change according to the amount of items are in the checklistbox. i.e.
If the checklistbox has 5 items, I want the trackbar to only have 5 points (maximum point) also.
Is this possible, I've tried to carry this out with a listbox and a checklistbox but neither works....
trackBar1.Maximum = checkedlistbox1.Items.Count;
What I have tried:
trackbar1.Value = checkedlistboox.Items.Count.ToString();
推荐答案
您显示的代码有拼写错误,并且(非法)尝试将字符串指定为TrackBar值;这有效:
The code you show has spelling errors, and an (illegal) attempt to assign a string as a TrackBar value; this works:
trackBar1.Maximum = checkedListBox1.Items.Count;
trackBar1.Value = trackBar1.Maximum;
但是......我猜你想要对CheckedListBox中的项目数进行任何更改以反映在TrackBar中...为什么呢你会拥有一个TrackBar吗?很可能,但可能的是,你不知何故想要改变TrackBar值来控制CheckedListBox中的项目数。
为什么不澄清你在这做什么?
But ... I'm guessing you want any change to the number of items in the CheckedListBox to be reflected in the TrackBar ... why else would you have a TrackBar ? Much less likely, but possible, is that you somehow want a change in the TrackBar value to control the number of items in the CheckedListBox.
Why don't you clarify what you are doing here ?
这篇关于跟踪栏指向checkedlistbox中的相同项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!