在我的菜单中,我使用链接按钮和标签在面板中动态创建面包屑路径。不管我做什么,我都无法让它正确包装。
- 面板:Wrap=True,Width=400px,ScrollBars=None
- LinkButton: style="white-space: nowrap"
- 标签:text=">",所以没有空格
- margin-left: 5px 用于面板和面板内
将 LinkButton 样式的空白设置为“nowrap”,面板不会自动换行文本。
Home > Chevy > Trucks > Silverado > Engineering Department > Fuel System
将 LinkButton 样式的空白设置为“正常”,它会换行,但不是我需要的。
Home > Chevy > Trucks > Silverado >
Engineering
Department >
Fuel
System
这就是我要找的:
Home > Chevy > Trucks > Silverado >
Engineering Department > Fuel System
这是我在选择菜单项时创建链接的代码隐藏。
Private Sub CreateLink(name As String, id As Integer)
Dim link As LinkButton
Dim lbl As Label
link = New LinkButton
link.Text = name
link.SkinID = id
link.Style.Add("white-space", "nowrap")
AddHandler link.Click, AddressOf Links_Click
BreadCrumbPanel.Controls.Add(link)
lbl = New Label
lbl.Text = ">"
BreadCrumbPanel.Controls.Add(lbl)
End Sub