<tfoot id='Y2YE0'></tfoot>
    <bdo id='Y2YE0'></bdo><ul id='Y2YE0'></ul>
  • <i id='Y2YE0'><tr id='Y2YE0'><dt id='Y2YE0'><q id='Y2YE0'><span id='Y2YE0'><b id='Y2YE0'><form id='Y2YE0'><ins id='Y2YE0'></ins><ul id='Y2YE0'></ul><sub id='Y2YE0'></sub></form><legend id='Y2YE0'></legend><bdo id='Y2YE0'><pre id='Y2YE0'><center id='Y2YE0'></center></pre></bdo></b><th id='Y2YE0'></th></span></q></dt></tr></i><div id='Y2YE0'><tfoot id='Y2YE0'></tfoot><dl id='Y2YE0'><fieldset id='Y2YE0'></fieldset></dl></div>

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

      1. <legend id='Y2YE0'><style id='Y2YE0'><dir id='Y2YE0'><q id='Y2YE0'></q></dir></style></legend>

        如何快速选择 ListBox 中的所有项目?

        时间:2023-10-06

      2. <tfoot id='9kYGV'></tfoot><legend id='9kYGV'><style id='9kYGV'><dir id='9kYGV'><q id='9kYGV'></q></dir></style></legend>

        <small id='9kYGV'></small><noframes id='9kYGV'>

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

                1. 本文介绍了如何快速选择 ListBox 中的所有项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在绑定到数据源 (BindingList) 的窗体 (Windows 窗体) 上有一个所有者绘制的 ListBox.我需要提供一个选项来快速选择所有项目(最多 500000 个).

                  I have an ownerdrawn ListBox on a form (Windows Forms) binding to a datasource (BindingList). I need to provide an option to select all items (up to 500000) really fast.

                  这就是我目前正在做的事情:

                  This is what I am currently doing:

                  for (int i = 0; i < listBox.Items.Count; i++)
                      listBox.SetSelected(i, true);
                  

                  这非常慢并且不可接受.有人知道更好的解决方案吗?

                  This is incredibly slow and not acceptable. Does anybody know a better solution?

                  推荐答案

                  假设这是一个 Windows 窗体 问题:Windows 窗体将在每个选定项之后绘制更改.要禁用绘图并在完成后启用它,请使用 BeginUpdate()EndUpdate() 方法.

                  Assuming this is a Windows Forms problem: Windows Forms will draw changes after each selected item. To disable drawing and enable it after you're done use the BeginUpdate() and EndUpdate() methods.

                  listBox.BeginUpdate();
                  
                  for (int i = 0; i < listBox.Items.Count; i++)
                      listBox.SetSelected(i, true);
                  
                  listBox.EndUpdate();
                  

                  这篇关于如何快速选择 ListBox 中的所有项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何设置列表框中选择的多个项目? 下一篇:防止将重复项添加到 ListBox

                  相关文章

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

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

                    1. <tfoot id='fSgnl'></tfoot>
                    2. <legend id='fSgnl'><style id='fSgnl'><dir id='fSgnl'><q id='fSgnl'></q></dir></style></legend>