【问题标题】:How can I set the exact height of a listbox in Windows Forms (C#)?如何在 Windows 窗体 (C#) 中设置列​​表框的确切高度?
【发布时间】:2010-11-24 09:26:14
【问题描述】:

我在设置列表框的高度时遇到了一些困难。

这样的代码...

listbox1.Height = some_number;

... 仅适用于某些数字。似乎列表框的高度可能只是其元素高度的乘积。有没有办法“覆盖”这种行为?

【问题讨论】:

    标签: c# winforms listbox height


    【解决方案1】:

    试试,

    listbox1.IntegralHeight=false;
    listbox1.Height=some_int_number;
    

    【讨论】:

      【解决方案2】:

      首先,设置

      listbox1.IntegralHeight = false;
      

      【讨论】:

        【解决方案3】:

        对于 VBA 代码:

        ActiveSheet.Shapes("ListBox1").ScaleWidth some_relate_numb, msoFalse, _     msoScaleFromTopLeft
        
        listbox1.IntegralHeight=false
        
        listbox1.Height=some_int_number
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2011-04-23
          • 2015-01-07
          • 1970-01-01
          • 1970-01-01
          • 2012-08-18
          • 2019-03-25
          • 2013-11-13
          • 1970-01-01
          相关资源
          最近更新 更多