【发布时间】:2013-04-24 22:00:15
【问题描述】:
我有一个包含列表框 (listbox1) 的用户控件。
水平滚动条设置为 TRUE。
另一个列表框 (selectionchanged) 上还有一个处理程序,用于设置 listbox1 的值(以防这可能导致问题)。
我将此用户控件添加到选项卡控件中的选项卡页中。
我面临的问题是,即使listbox1中显示的项目大于宽度,也不会显示水平滚动条。
有人知道我该如何解决这个问题吗?
谢谢
-编辑- 根据要求尽可能多地显示代码
dim tabpage as new Tabpage
dim dict as new dictionary(of String, list(of MyObject))
'fill dict
tabpage.add(usercontrol(dict))
tabcontrol1.tabpages.add(tabpage)
用户控制:
class UserControl
public sub new(dict)
Dim bs As BindingSource = New BindingSource(dict, Nothing)
ListBox1.DataSource = bs
ListBox1.DisplayMember = "Key"
end sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
ListBox2.DataSource = New BindingSource(CType(ListBox1.SelectedItem, KeyValuePair(Of String, List(Of MyObject))).Value, Nothing)
End Sub
End Class
【问题讨论】:
-
你应该考虑展示一些代码。
-
没有太多代码可以展示。使用设计器将列表框添加到用户控件,并在设计器中将 Horizontalscrollbar 的属性设置为 true。然后添加用户控件添加到一个标签页。会发布一些东西...
标签: vb.net listbox horizontal-scrolling