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

<legend id='9hCl4'><style id='9hCl4'><dir id='9hCl4'><q id='9hCl4'></q></dir></style></legend>
  • <tfoot id='9hCl4'></tfoot>

    • <bdo id='9hCl4'></bdo><ul id='9hCl4'></ul>

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

        隐藏 ListBox 控件中的垂直滚动条

        时间:2023-10-07

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

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

                <tfoot id='fivfu'></tfoot>

                  <legend id='fivfu'><style id='fivfu'><dir id='fivfu'><q id='fivfu'></q></dir></style></legend>
                  本文介绍了隐藏 ListBox 控件中的垂直滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个需要 ListBox 控件的应用程序.不幸的是,当我在 ListBox 中添加太多项目时,会显示一个垂直滚动条.我可以做些什么来隐藏 ListBox 显示的垂直滚动条吗?我可以看到有一个隐藏水平滚动条的属性,但没有垂直滚动条的属性.

                  I'm developing an application that requires a ListBox control. Unfortunately, when I add too many items in the ListBox, a vertical scroll bar is shown. Is there something I can do to hide the vertical scroll bar shown by the ListBox? I can see that there's a property to hide the horizontal scroll bar but there's no property for the vertical scroll bar.

                  推荐答案

                  问题解决了.我只是使用以下代码创建了一个模板类库的新项目

                  The problem was solved. I've simply created a new project of template a class library with the following code

                  using System;
                  using System.Collections.Generic;
                  using System.Linq;
                  using System.Text;
                  using System.Windows.Forms;
                  
                  namespace ClassLibrary1
                  {
                      public class MyListBox : System.Windows.Forms.ListBox
                      {
                          private bool mShowScroll;
                          protected override System.Windows.Forms.CreateParams CreateParams
                          {
                              get
                              {
                                  CreateParams cp = base.CreateParams;
                                  if (!mShowScroll)
                                      cp.Style = cp.Style & ~0x200000;
                                  return cp;
                              }
                          }
                          public bool ShowScrollbar
                          {
                              get { return mShowScroll; }
                              set
                              {
                                  if (value != mShowScroll)
                                  {
                                      mShowScroll = value;
                                      if (IsHandleCreated)
                                          RecreateHandle();
                                  }
                              }
                          }
                      }    
                  }
                  

                  然后,我构建了输出新类库的项目ClassLibrary1.dll

                  Then, I've built the project outputting a new class library ClassLibrary1.dll

                  在我的主项目中,我右键单击了 ToolBox 并选择了 Choose Items....点击 Browse... 并选择我最近创建的类库 (ClassLibrary1.dll) 并点击 Open 然后点击 OK.因此,我能够拥有不再有垂直滚动条的自定义 ListBox.

                  On my main project, I've right-clicked the ToolBox and selected Choose Items.... Clicked on Browse... and selected the class library that I've recently created (ClassLibrary1.dll) and clicked on Open then on OK. Thus, I was able to have my custom ListBox which has no vertical scroll bars anymore.

                  这篇关于隐藏 ListBox 控件中的垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在 ASP.NET ListBox 中设置多项选择? 下一篇:ListBox DrawItem HotLight 在 OwnerDraw 模式下的状态?

                  相关文章

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

                    <tfoot id='5WeQg'></tfoot>
                      <bdo id='5WeQg'></bdo><ul id='5WeQg'></ul>

                    <small id='5WeQg'></small><noframes id='5WeQg'>

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