开发者

How does one make a horizontal listbox in .NET

I am working on porting a VB6 application to .NET and one of the desired UI elements is a horizontal listbox. I can't seem to figure out how to replicate this in .NET.

  1. Can this be done with basic winforms?

  2. How would you replicate this?

Sample:

How does one make a horizontal listbox in .NET

The VB6 code that will replicate the above image:

Private Sub Form_Load()
    lst_horizontal(1).FontSize = 6
    Dim iMaxChoices As Integer
    iMaxChoices = 10
    For i = 1 To iMaxChoices
        lst_horizontal(1).AddItem (" " + CStr(i))
    Next i
End Sub

Private Sub lst_horizontal_Click(Index As Integer)
    Dim iMaxChoices As Integer
    iMaxChoices = 10

    For i = 0 To iMaxChoices - 1

        If lst_horizontal(1).开发者_高级运维Selected(i) Then
            Debug.Print ("Item " + CStr(i + 1) + " selected")
        End If

    Next i

Weasel words: I can figure out how to replicate this in Silverlight/XAML, but this app can't be done in that fashion.


I would suggest the ListView with LargIcon for View property, It might be a good and ready solution for your case.

How does one make a horizontal listbox in .NET

Good luck!


This is supported in Winforms as well. Set the MultiColumn property to True, the ColumnWidth property to, say, 15. Producing:

How does one make a horizontal listbox in .NET

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜