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

      <tfoot id='YbtAa'></tfoot>
      • <bdo id='YbtAa'></bdo><ul id='YbtAa'></ul>
      <legend id='YbtAa'><style id='YbtAa'><dir id='YbtAa'><q id='YbtAa'></q></dir></style></legend>

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

      1. 如果内容字符串宽度大于 ListBox 宽度,Winforms DotNet ListBox 项目以自动换行?

        时间:2023-10-07
          <tbody id='r0aOq'></tbody>
      2. <legend id='r0aOq'><style id='r0aOq'><dir id='r0aOq'><q id='r0aOq'></q></dir></style></legend>

        1. <small id='r0aOq'></small><noframes id='r0aOq'>

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

                  本文介绍了如果内容字符串宽度大于 ListBox 宽度,Winforms DotNet ListBox 项目以自动换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  嗯,嗯,这意味着有些行的大小应该是两行.我的老板认为这是更简单的解决方案,而不是限制显示的文本以适合宽度并且不喜欢水平滚动条>_<

                  Ehm, umm, this means some lines should be two-lined in size. My boss think this is more simple solution, than limit displayed text to fit width and don't like horizontal scroll bar >_<

                  推荐答案

                  lst.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
                  lst.MeasureItem += lst_MeasureItem;
                  lst.DrawItem += lst_DrawItem;
                  
                  private void lst_MeasureItem(object sender, MeasureItemEventArgs e)
                  {
                      e.ItemHeight = (int)e.Graphics.MeasureString(lst.Items[e.Index].ToString(), lst.Font, lst.Width).Height;
                  }
                  
                  private void lst_DrawItem(object sender, DrawItemEventArgs e)
                  {
                      e.DrawBackground();
                      e.DrawFocusRectangle();
                      e.Graphics.DrawString(lst.Items[e.Index].ToString(), e.Font, new SolidBrush(e.ForeColor), e.Bounds);
                  }
                  

                  这篇关于如果内容字符串宽度大于 ListBox 宽度,Winforms DotNet ListBox 项目以自动换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将选定和未聚焦的列表框样式更改为不灰显 下一篇:如何将图像添加到 System.Windows.Forms.ListBox?

                  相关文章

                    <bdo id='bDCDx'></bdo><ul id='bDCDx'></ul>
                • <tfoot id='bDCDx'></tfoot><legend id='bDCDx'><style id='bDCDx'><dir id='bDCDx'><q id='bDCDx'></q></dir></style></legend>

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

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