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
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器