.NET/VB.NET
[VB.NET] 이거 아십니까? ListBox 의 MultiColumn
WooGong Peter
2009. 4. 30. 21:07
반응형
폼을 하나 만드시고
리스트 박스 하나, 버튼 두개 올리시고 아래 소스를 복사해서 실행시켜보시지요...
무식한 정환이...
멀티 컬럼이라는 새로운 속성에 좋아라 했답니다.
근데 실은 멀티 컬럼이라고 해서 리스트 뷰처럼 하나의 아이템에 두 컬럼 혹은 세 컬럼이 나오는 그런 속성인줄 알았었는데... 조금은 실망했습니다. 하지만 서도 새로운 걸 발견했다는... (이제서야... ㅡㅡ')
행복한 고수되셔요...
woojja ))*
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
== 소스는 MSDN 을 약간 변형한 것입니다.
리스트 박스 하나, 버튼 두개 올리시고 아래 소스를 복사해서 실행시켜보시지요...
무식한 정환이...
멀티 컬럼이라는 새로운 속성에 좋아라 했답니다.
근데 실은 멀티 컬럼이라고 해서 리스트 뷰처럼 하나의 아이템에 두 컬럼 혹은 세 컬럼이 나오는 그런 속성인줄 알았었는데... 조금은 실망했습니다. 하지만 서도 새로운 걸 발견했다는... (이제서야... ㅡㅡ')
| Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim x As Integer ' Add items to the ListBox. For x = 0 To 50 ListBox1.Items.Add("Items " + x.ToString()) Next x ' Display items in columns. ' Determine the width of the items in the list to get the best column width setting. Dim width As Integer = CInt(ListBox1.CreateGraphics().MeasureString(ListBox1.Items(ListBox1.Items.Count - 1).ToString(), _ ListBox1.Font).Width) ' Set the column width based on the width of each item in the list. ListBox1.ColumnWidth = width End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ListBox1.MultiColumn = Not ListBox1.MultiColumn End Sub End Class |
행복한 고수되셔요...
woojja ))*
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
== 소스는 MSDN 을 약간 변형한 것입니다.
반응형