【问题标题】:Change the height of the panel of the split container at runtime在运行时更改拆分容器的面板高度
【发布时间】:2014-07-17 18:56:46
【问题描述】:

我有一个拆分容器,我会在运行时更改 panel1 的高度。我用这个代码

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SplitContainer1.Panel1.Height = 2
    End Sub

有可能吗?有人有什么建议吗?

非常感谢。

【问题讨论】:

  • 2 是一个非常小的数字。你确定你只是不想打电话给splitContainer1.Panel1Collapsed = true;

标签: vb.net winforms splitcontainer


【解决方案1】:

我认为您正在寻找SplitContainer.SplitterDistance 的属性。来自documentation

获取或设置拆分器从 SplitContainer 的左边缘或上边缘开始的位置(以像素为单位)。

【讨论】:

    【解决方案2】:

    根据我的评论,你应该考虑打电话

    splitContainer1.Panel1Collapsed = true;
    

    因为 2 的高度是一个非常小的数字。对用户没有多大用处。

    否则,您必须设置以下两个属性:

    splitContainer1.Panel1MinSize = 2;
    splitContainer1.SplitterDistance = 2;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多