<legend id='6iSU5'><style id='6iSU5'><dir id='6iSU5'><q id='6iSU5'></q></dir></style></legend>

        <small id='6iSU5'></small><noframes id='6iSU5'>

          <bdo id='6iSU5'></bdo><ul id='6iSU5'></ul>
        <tfoot id='6iSU5'></tfoot>

      1. <i id='6iSU5'><tr id='6iSU5'><dt id='6iSU5'><q id='6iSU5'><span id='6iSU5'><b id='6iSU5'><form id='6iSU5'><ins id='6iSU5'></ins><ul id='6iSU5'></ul><sub id='6iSU5'></sub></form><legend id='6iSU5'></legend><bdo id='6iSU5'><pre id='6iSU5'><center id='6iSU5'></center></pre></bdo></b><th id='6iSU5'></th></span></q></dt></tr></i><div id='6iSU5'><tfoot id='6iSU5'></tfoot><dl id='6iSU5'><fieldset id='6iSU5'></fieldset></dl></div>
      2. 如何在 C# 中的列表框中插入复选框?

        How to insert a check box inside a list box in C#?(如何在 C# 中的列表框中插入复选框?)

        <small id='wSRb5'></small><noframes id='wSRb5'>

        <tfoot id='wSRb5'></tfoot>
        1. <legend id='wSRb5'><style id='wSRb5'><dir id='wSRb5'><q id='wSRb5'></q></dir></style></legend>
            <i id='wSRb5'><tr id='wSRb5'><dt id='wSRb5'><q id='wSRb5'><span id='wSRb5'><b id='wSRb5'><form id='wSRb5'><ins id='wSRb5'></ins><ul id='wSRb5'></ul><sub id='wSRb5'></sub></form><legend id='wSRb5'></legend><bdo id='wSRb5'><pre id='wSRb5'><center id='wSRb5'></center></pre></bdo></b><th id='wSRb5'></th></span></q></dt></tr></i><div id='wSRb5'><tfoot id='wSRb5'></tfoot><dl id='wSRb5'><fieldset id='wSRb5'></fieldset></dl></div>

              <tbody id='wSRb5'></tbody>
            • <bdo id='wSRb5'></bdo><ul id='wSRb5'></ul>

                • 本文介绍了如何在 C# 中的列表框中插入复选框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想要一个代码在 c 语言的列表框中插入一个复选框.在选中复选框时,列表框中的所有项目都必须被选中.

                  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.

                  推荐答案

                  您可以使用 CheckListBox 显示一个列表,每个项目旁边都有一个复选框.

                  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:

                  public void SelectAllCheckBox_CheckedChanged(object s, EventArgs e) 
                  {
                      foreach (var item in ListBox1.Items) 
                      {
                          item.Selected = SelectAllCheckBox.Checked;
                      }
                  }
                  

                  列表中没有任何控件具有单个复选框:例如,这就是您的意思:

                  There is no control that has a single check box inside a list: eg this is what you mean:

                  +----------------------------------------+
                  | [x] Select All                         |
                  | Item one                               |
                  | Item two                               |
                  | Item three                             |
                  | Item four                              |
                  | Item five                              |
                  +----------------------------------------+
                  

                  相反,您必须使用两个控件:一个复选框和一个单独的列表框:

                  Instead you must use two controls: a checkbox and a separate list box:

                  [x] Select All                         
                  
                  +----------------------------------------+
                  | Item one                               |
                  | Item two                               |
                  | Item three                             |
                  | Item four                              |
                  | Item five                              |
                  +----------------------------------------+
                  

                  这篇关于如何在 C# 中的列表框中插入复选框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Populate ListBox with a IEnumrable on another thread (winforms)(在另一个线程(winforms)上使用 IEnumrable 填充 ListBox)
                  listbox selected item give me quot; System.Data.DataRowViewquot; , C# winforms(列表框选择的项目给我quot;System.Data.DataRowView, C# Winforms)
                  Cannot remove items from ListBox(无法从列表框中删除项目)
                  Preventing ListBox scrolling to top when updated(更新时防止列表框滚动到顶部)
                  Drag and drop from list to canvas on windows phone with MVVM(使用 MVVM 在 Windows 手机上从列表拖放到画布)
                  Deselection on a WPF listbox with extended selection mode(具有扩展选择模式的 WPF 列表框上的取消选择)
                • <i id='sDKxN'><tr id='sDKxN'><dt id='sDKxN'><q id='sDKxN'><span id='sDKxN'><b id='sDKxN'><form id='sDKxN'><ins id='sDKxN'></ins><ul id='sDKxN'></ul><sub id='sDKxN'></sub></form><legend id='sDKxN'></legend><bdo id='sDKxN'><pre id='sDKxN'><center id='sDKxN'></center></pre></bdo></b><th id='sDKxN'></th></span></q></dt></tr></i><div id='sDKxN'><tfoot id='sDKxN'></tfoot><dl id='sDKxN'><fieldset id='sDKxN'></fieldset></dl></div>

                  • <bdo id='sDKxN'></bdo><ul id='sDKxN'></ul>

                    <legend id='sDKxN'><style id='sDKxN'><dir id='sDKxN'><q id='sDKxN'></q></dir></style></legend>
                      <tbody id='sDKxN'></tbody>

                    <tfoot id='sDKxN'></tfoot>
                    • <small id='sDKxN'></small><noframes id='sDKxN'>