在ListBox适当设定水平滚动条的宽度_VB.net_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

在ListBox适当设定水平滚动条的宽度

作者:黑客防线网安VB教程基地 来源:黑客防线网安VB教程基地 浏览次数:0

本篇关键词:滚动水平设定适当
黑客防线网安网讯:Option Explicit Private Const LB_SETHORIZONTALEXTENT = &H194 Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByV...

Option Explicit
Private Const LB_SETHORIZONTALEXTENT = &H194
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 Command1_Click()
Dim max As Long, f As Font, i As Integer

Me.ScaleMode = vbPixels
Set f = Me.Font
Set Me.Font = List1.Font

With List1
For i = 0 To .ListCount
If Me.TextWidth(.List(i)) > max Then
max = Me.TextWidth(.List(i))
End If
Next
End With
max = max + 10

Set Me.Font = f

SendMessage List1.hwnd, LB_SETHORIZONTALEXTENT, max, ByVal 0&
End Sub

Private Sub Form_Load()
List1.AddItem "VB编程乐园"
List1.AddItem "http://www.vbeden.com"
List1.AddItem "这是一个特别特别长的选项长到超过ListBox的范围"
End Sub

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-14739-1.html
网站维护教程更新时间:2012-04-03 01:13:38  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer