[VB.NET]如何把Combobox的下拉列表显示成Checkbox?

VB.NET源码-156个实用实例哦…… <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
如何把Combobox的下拉列表显示成Checkbox?
如何把Combobox的下拉列表显示成Checkbox,就像CheckedListBox.
(为什么有CheckedListBox而没有CheckedCombobox)
__________________________________________________________________________
'' 在窗体中加入一个CheckedListBox,和一个ComboBox
Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
With Me.CheckedListBox1
.Visible = False
.Items.Add( "Check it out! ")
.Items.Add( "How about this? ")
.Items.Add( "Tis good too! ")
.Height = Me.CheckedListBox1.Items.Count * 18
.CheckOnClick = True
End With
Me.Timer1.Enabled = False
Me.Timer1.Interval = 10
End Sub

Private Sub ComboBox1_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.DropDown
Me.ComboBox1.DropDownHeight = 1
With Me.CheckedListBox1
.Top = Me.ComboBox1.Top + Me.ComboBox1.Height
.Left = Me.ComboBox1.Left
.Width = Me.ComboBox1.Width
.Visible = True
End With
End Sub

Private Sub CheckedListBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckedListBox1.MouseLeave
Me.CheckedListBox1.Visible = False
Me.ComboBox1.Text = " "
For i As Int32 = 0 To Me.CheckedListBox1.CheckedItems.Count - 1
Me.ComboBox1.Text &= Me.CheckedListBox1.CheckedItems(i).ToString & ", "
Next
Me.ComboBox1.Text = Me.ComboBox1.Text.TrimEnd( ", ")
End Sub
End Class
__________________________________________________________________________
我是从Cooly(☆不做开发很久了......☆)老兄的一个回帖里看到的。

参考:http://topic.csdn.net/t/20030304/15/1490274.html#
__________________________________________________________________________
学习
__________________________________________________________________________
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值