将垂直滚动条隐藏在1个列表框中

时间:2015-05-28 02:20:42

标签: vb.net visual-studio-2012 listbox scrollbar

有人可以帮我隐藏列表框的垂直滚动条。

我正在使用visual studio 2012,我正在用vb进行编码

1 个答案:

答案 0 :(得分:0)

使用某些API调用怎么样?

请查看此链接以了解如何实施...

http://www.xtremevbtalk.com/archive/index.php/t-270345.html

 Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As IntPtr) As Int32
 Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As IntPtr, ByVal wBar As Int32, ByVal bShow As Int32) As Int32

 Private Const SB_VERT = 1


 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  ShowScrollBar(ListBox1.Handle, SB_VERT, False)
 End Sub

 'scroll down
 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  LockWindowUpdate(ListBox1.Handle)
  ListBox1.TopIndex = ListBox1.TopIndex + 1
  ShowScrollBar(ListBox1.Handle, SB_VERT, False)
  LockWindowUpdate(0&)
 End Sub

 'scroll up
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
 LockWindowUpdate(ListBox1.Handle)
 ListBox1.TopIndex = ListBox1.TopIndex - 1
 ShowScrollBar(ListBox1.Handle, SB_VERT, False)
 LockWindowUpdate(0&)
End Sub