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

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

      <tfoot id='oBdwB'></tfoot>

      1. 无法使用 TabStops 使 ListBox 中的项目正确对齐

        Can#39;t make the items in a ListBox align correctly using TabStops(无法使用 TabStops 使 ListBox 中的项目正确对齐)
        <legend id='ZWdzk'><style id='ZWdzk'><dir id='ZWdzk'><q id='ZWdzk'></q></dir></style></legend>
          <tbody id='ZWdzk'></tbody>
      2. <small id='ZWdzk'></small><noframes id='ZWdzk'>

        <tfoot id='ZWdzk'></tfoot>
          <bdo id='ZWdzk'></bdo><ul id='ZWdzk'></ul>

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

                1. 本文介绍了无法使用 TabStops 使 ListBox 中的项目正确对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  ListbBox 有以下问题.

                  I have the following problem with ListbBox.

                  为了便于理解,我做了一些简化.

                  To make it easy to understand I have simplified it a bit.

                  public partial class Form1 : Form
                  {
                      private void Form1_Load(object sender, EventArgs e)
                      {
                          listBox1.Items.Add("xxxxxx" +"			"+ "yyyyyyy");
                          listBox1.Items.Add("xxxxxxx" + "			" + "yyyyyyy");
                          listBox1.Items.Add("xxxxxxxx" + "			" + "yyyyyyy");
                          listBox1.Items.Add("xxxxxxxxx" + "			" + "yyyyyyy");
                          listBox1.Items.Add("xxxxxxxxxx" + "			" + "yyyyyyy");
                      }
                  }
                  

                  从第 1 行到第 4 行,它以直线向下完美地打印出来.但是当我运行程序时,第 5 行完全关闭了,虽然有足够的空间.任何人都可以帮我把所有物品都排成直线向下吗?

                  From row 1 to 4 it prints out perfectly in straight rows downwards. But the 5th row is completly off when I run the program, although there is plenty of space. Can any body help me to get all items to be in straight rows downwards?

                  推荐答案

                  需要设置属性CustomTabOffsets 和属性 UseCustomTabOffsets 然后您可以将字符串中的制表符数量减少到只有一个.

                  You need to set the property CustomTabOffsets and the property UseCustomTabOffsets and then you can reduce the number of tabs in your strings to only one.

                  例如

                  ListBox lb = new ListBox();
                  lb.Size = new Size(500, 200);
                  lb.CustomTabOffsets.Add(100);
                  lb.UseCustomTabOffsets = true;
                  
                  lb.Items.Add("xxxxxx" + "	" + "yyyyyyy");
                  lb.Items.Add("xxxxxxx" + "	" + "yyyyyyy");
                  lb.Items.Add("xxxxxxxx" + "	" + "yyyyyyy");
                  lb.Items.Add("xxxxxxxxx" + "	" + "yyyyyyy");
                  lb.Items.Add("xxxxxxxxxx" + "	" + "yyyyyyy");
                  
                  Form f = new Form();
                  f.Controls.Add(lb);
                  f.Show();
                  

                  当然,您应该将 100 更改为与字符串第一部分的实际最大长度和 ListBox 的宽度更一致的值

                  Of course you should change that 100 to something more consistent with the actual maximum length of the first part of your strings and the width of your ListBox

                  这篇关于无法使用 TabStops 使 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 列表框上的取消选择)

                  <small id='4kHk5'></small><noframes id='4kHk5'>

                  <legend id='4kHk5'><style id='4kHk5'><dir id='4kHk5'><q id='4kHk5'></q></dir></style></legend>

                  • <bdo id='4kHk5'></bdo><ul id='4kHk5'></ul>

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

                      <tbody id='4kHk5'></tbody>