I want a code to insert a checkbox inside a listbox in c sharp. on selecting the checkbox all the items in listbox must get selected.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You can use a CheckListBox to display a list with a check box next to each item.
But to make a single checkbox that selects everything in a list, it must be outside the list box (above or below or beside it). Then you can use code like:
There is no control that has a single check box inside a list: eg this is what you mean:
Instead you must use two controls: a checkbox and a separate list box:
Maybe you could extend the mentioned CheckedListBox, and handle a few Events so that only the first CheckBox is visible (maybe some kind of formatting event would be good for that).
And don't forget to use the onCheckedChangeEvent, so that you (de-)select all elements on change of the checkbox-value.