• <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 项目以自动换行?

        Winforms DotNet ListBox items to word wrap if content string width is bigger than ListBox width?(如果内容字符串宽度大于 ListBox 宽度,Winforms DotNet ListBox 项目以自动换行?)
          <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 项目以自动换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 列表框上的取消选择)
                    <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>
                            <tbody id='bDCDx'></tbody>

                          <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'>