ListBox控件不增大字体怎么加大行间距?

jinyongfans 2005-09-08 09:35:16
我需要在触摸屏程序中使用LISTBOX控件,默认间距太小,加大字体又太难看,请问在不加大字体的情况下怎么使行间距增大?
...全文
1199 15 打赏 收藏 举报
写回复
15 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
jinyongfans 2005-09-20
VB不是不区分大小写吗? 我把wzzwwz(棒子面窝头) 与 of123() 二位的代码拷贝过去的,提示:找不到DLL入口点 sendMessageA in user32 ?
  • 打赏
  • 举报
回复
yinweihong 2005-09-15
大小写的问题,肯定是声明出错,,
从API View中复制啊
  • 打赏
  • 举报
回复
jinyongfans 2005-09-15
为什么提示:找不到DLL入口点 sendMessageA in user32 ?
  • 打赏
  • 举报
回复
wzzwwz 2005-09-09
不会吧,控件不会加?
双击工具箱中的 ListBox 就行了。或者但是工具箱中的 ListBox ,然后用鼠标在窗体上画一个。
  • 打赏
  • 举报
回复
of123 2005-09-09
设置列表项的高度:

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
Const LB_SETITEMHEIGHT = &H1A0
Const CB_SETITEMHEIGHT = &H153

' Set the height in pixels of each entry in a ListBox or ComboBox control

Sub SetListItemHeight(ctrl As Control, ByVal newHeight As Long)
Dim uMsg As Long
If TypeOf ctrl Is ListBox Then
uMsg = LB_SETITEMHEIGHT
ElseIf TypeOf ctrl Is ComboBox Then
uMsg = CB_SETITEMHEIGHT
Else
Exit Sub
End If
' (only the low-order word of lParam can be used.)
SendMessage ctrl.hwnd, uMsg, 0, Byval CLng(newHeight And &HFFFF&)
' It is necessary to manually refresh the control.
ctrl.Refresh
End Sub
  • 打赏
  • 举报
回复
phommy 2005-09-09
请问:List控件找不到,请问怎么添加?
  • 打赏
  • 举报
回复
wzzwwz 2005-09-09
Option Explicit

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 Const LB_GETITEMHEIGHT = &H1A1
Private Const LB_SETITEMHEIGHT = &H1A0
Dim lstH As Long

Private Sub Command1_Click()
lstH = SendMessage(List1.hwnd, LB_GETITEMHEIGHT, 0, ByVal 0&)
MsgBox "列表框条目原来的高度是:" & lstH, , ""
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
End Sub

Private Sub Command2_Click()
Dim temp As Single
Dim lstHtemp As Long
temp = InputBox("请输入列表框条目的新的高度(原来高度的倍数)")
lstHtemp = CLng(temp * lstH)
SendMessage List1.hwnd, LB_SETITEMHEIGHT, 0, ByVal lstHtemp
List1.Refresh
MsgBox "列表框条目的新高度势:" & lstHtemp, , ""
End Sub

Private Sub Command3_Click()
SendMessage List1.hwnd, LB_SETITEMHEIGHT, 0, ByVal lstH
List1.Refresh
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Form_Load()
List1.AddItem "AAAAAAAAAA"
List1.AddItem "BBBBBBBBBBBBBB"
List1.AddItem "CCCCCCCCCCCCCCCCCCCC"
List1.AddItem "DDDDDDDDDDDDD"

Command1.Caption = "显示原高度"
Command2.Caption = "设置新高度"
Command3.Caption = "恢复原高度"
Command4.Caption = "退 出"
Form1.Caption = "用列表框消息设置条目高度"

Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
End Sub

'四个按钮,一个列表框
  • 打赏
  • 举报
回复
love_tree 2005-09-09
listview中如何设置行高
  • 打赏
  • 举报
回复
xiaoMONKEY 2005-09-08
LISTBOX控件好象是不能的
用TREEVIEW行不?
  • 打赏
  • 举报
回复
Andy__Huang 2005-09-08
你試考慮用別的控件ListView可以嗎?
  • 打赏
  • 举报
回复
zwbwork 2005-09-08
顶一下
  • 打赏
  • 举报
回复
wangdeshui 2005-09-08
listview datagrid treeview flexgrid 都可以
  • 打赏
  • 举报
回复
delbrueck 2005-09-08
listview
  • 打赏
  • 举报
回复
northwolves 2005-09-08
ListView 实现起来比较简单
  • 打赏
  • 举报
回复
weiweiplay 2005-09-08
自己做一个控件吧,ListBox好像实现不了
  • 打赏
  • 举报
回复
发帖
控件

1434

社区成员

VB 控件
社区管理员
  • 控件
加入社区
帖子事件
创建了帖子
2005-09-08 09:35
社区公告
暂无公告