我有一个listView
我在for循环中添加了许多按钮。但是,即使我将listView
设置为scrollable
,scrollable
也不会listview
。我不确定为什么会这样。我只是在每次进入for循环时添加一个按钮,但是一旦在 ListViewTemplates.HeaderStyle = ColumnHeaderStyle.None
For i As Integer = 1 To level3Cat.Count
counter = i Mod 2
If counter = 0 Then
Dim picture As Button = New Button()
picture.Location = New System.Drawing.Point(165, topForNextControl)
picture.Size = New System.Drawing.Size(90, layoutTemplateHeight)
picture.TabStop = False
picture.BackgroundImageLayout = BackgroundImageLayout.Stretch
picture.BackgroundImage = My.Resources.XButton
ListViewTemplates.Controls.Add(picture)
topForNextControl += layoutTemplateHeight + HeighScaleFactor
Else
Dim picture As Button = New Button()
picture.Location = New System.Drawing.Point(35, topForNextControl)
picture.Size = New System.Drawing.Size(90, layoutTemplateHeight)
picture.TabStop = False
picture.BackgroundImageLayout = BackgroundImageLayout.Stretch
picture.BackgroundImage = My.Resources.XButton
ListViewTemplates.Controls.Add(picture)
End If
ListViewTemplates.Scrollable = True
ListViewTemplates.View = View.Details
counter += 1
Next
上有太多按钮无法查看,就会出现无滚动条。我的代码如下。
var customers = [{
"Name" : "John",
"Items" :[
{"Fruits" : "Apple"},{"Fruits" : "Orange"}]
},{
"Name" : "Sam",
"Items" :[
{"Fruits" : "Pear"},{"Fruits" : "Nuts"}]
},{
"Name" : "Eric",
"Items" :[
{"Fruits" : "Banana"},{"Fruits" : "Raisins"}]
}];
for(i=0; i<=customers.length; i++){
for(a=0; a<=customers.length; a++){
alert(customers[i]["Items"][a]);
}
}