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

前端之家收集整理的这篇文章主要介绍了[VB.NET]如何把Combobox的下拉列表显示成Checkbox?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何把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# __________________________________________________________________________ 学习 __________________________________________________________________________ 原文链接:https://www.f2er.com/vb/263774.html

猜你在找的VB相关文章