VB滚动条
就是普通的滚动而已,举个例吧,我有1个text控件,如何用滚动条控制这个TEXT控件的滚动......
就是普通的滚动而已,举个例吧,我有1个text控件,如何用滚动条控制这个TEXT控件的滚动...
展开
3个回答
展开全部
设置它们的Top ,Left 属性相同即可
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub VScroll1_Change()
Image1.Top = VScroll1.Value ‘滚动条控制片控件的高低,你看看吧
End Sub
Image1.Top = VScroll1.Value ‘滚动条控制片控件的高低,你看看吧
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
要用系统消息读TEXT到了第几行,与滚动条VALUE相联.
追问
最好有代码...
追答
明天帮你找找看
看这样行不:
Option Explicit
Private Const EM_LINESCROLL = &HB6
Private Const EM_SCROLL = &HB5
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_GETLINE = &HC4
Private Const EM_LINELENGTH = &HC1
Private Const EM_SETSEL = &HB1
Private Const SB_LINEDOWN = 1
Private Const SB_LINELEFT = 0
Private Const SB_LINERIGHT = 1
Private Const SB_LINEUP = 0
Private Const SB_PAGEDOWN = 3
Private Const SB_PAGELEFT = 2
Private Const SB_PAGERIGHT = 3
Private Const SB_PAGEUP = 2
Private Const SB_RIGHT = 7
Private lLineCount As Long
Private lLineShow As Long
Private lLineNow As Long
Private lLinePre As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Form_Load()
'计算有多少行
lLineCount = SendMessage(Me.Text1.hwnd, EM_GETLINECOUNT, 0, ByVal 0)
'计算现在显示的有几行
lLineShow = Int(Me.Text1.Height / Me.TextHeight("HELLO"))
Me.VScroll1.Max = lLineCount - lLineShow
End Sub
Private Sub Text1_Change()
'计算有多少行
lLineCount = SendMessage(Me.Text1.hwnd, EM_GETLINECOUNT, 0, ByVal 0)
'计算现在显示的有几行
lLineShow = Int(Me.Text1.Height / Me.TextHeight("HELLO"))
Me.VScroll1.Max = lLineCount - lLineShow
End Sub
Private Sub VScroll1_Change()
Dim lRet As Long
lRet = SendMessage(Me.Text1.hwnd, EM_LINESCROLL, 0, ByVal (VScroll1.Value - lLinePre))
lLinePre = VScroll1.Value
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询