增加CheckedListBox项目行间距

时间:2013-10-08 16:08:50

标签: .net vb.net checkedlistbox

是否可以增加VB.Net中CheckedListBox中项目之间的空间?怎么样?

1 个答案:

答案 0 :(得分:0)

取决于间距的含义。如果是Horizo​​ntal,则使用“ColumnWidth”。如果你想要垂直间距,那么你必须继承控件并取消隐藏棘手的“ItemHeight”属性(见下文)。它很棘手,如果IntergralHeight设置为TRUE,它会改变整个控件的高度。

Public Class CLB2
Inherits CheckedListBox

Protected _ItemHeight As Integer = 17

<Browsable(True), EditorBrowsable(EditorBrowsableState.Always), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)>
Public Overrides Property ItemHeight As Integer
    Get
        Return _ItemHeight
    End Get
    Set(ByVal value As Integer)
        _ItemHeight = value
        Me.ColumnWidth += 1     'Force an immediate Update
        Me.ColumnWidth -= 1
    End Set
End Property
End Class