标题:在picturebox放置VScroll滚动条控件,动态加载label控件 ,不能实现滚动显示 ...
取消只看楼主
cmsj3999
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2019-7-29
结帖率:0
已结贴  问题点数:20 回复次数:0 
在picturebox放置VScroll滚动条控件,动态加载label控件 ,不能实现滚动显示?
vb6中 在窗体上建一个容器picture3,并添加滚动条控件,picture4放在picture3内, 在picture4内动态添加label控件用其canption属性来显示数值,想用滚动条来控制显示超出picture3范围的内容,运行后,拖动滚动条后,超出部分显示的是空白,没人label内容,请高手帮忙看看,怎么回事。
但在picture4上加载图片,用滚动条则能实现滚动浏览。

Dim top2,h as Integer
Private Sub Form_Load()
    Me.VScroll1.Visible = False '滚动条不可见
    Me.Picture4.AutoSize = True
    Me.VScroll1.Min = 0
    Me.VScroll1.Max = Me.Picture4.Height t - Me.Picture3.Height
Me.VScroll1.LargeChange = 365

Set labl(h) = Me.Controls.Add("VB.Label", "labl" & h, Picture4)
'      top2 = 3720 + 365 * (h - 1)
         top2 = 365 * (h - 1)
      With labl(h)
'             labl(h).left = 120
             labl(h).left = -10
             labl(h).Top = top2

             labl(h).Width = 2295
             labl(h).Height = 375
             labl(h).Visible = True

            labl(h).BackStyle = 0
            labl(h).BorderStyle = 1
            labl(h).Appearance = 0
            labl(h).Alignment = 2
            labl(h).FontSize = 8
            labl(h).Caption = tmparry(h)
      End With
End sub

Private Sub VScroll1_Change()
Me.Picture4.Top = VScroll1.Value
End Sub

Private Sub VScroll1_Scroll()
Me.Picture4.Top = VScroll1.Value
End Sub


[此贴子已经被作者于2019-7-29 15:42编辑过]

搜索更多相关主题的帖子: 滚动条 控件 label 显示 Sub 
2019-07-29 11:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-496083-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013596 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved