Star Star - 22 days ago 8x
C# Question

How to change CheckedListBox item vertical space

I need to change the vertical space for

items so they fit with the text boxes on the other side:

CheckedListBox and "TextBox"s side to side
How to do this ?

After doing some research I found out that
, so it must have its public property
, but for some reason it doesn't

I tried this :

ListBox l = CheckedList as ListBox;
l.ItemHeight = 30;

but it didn't work


The default implementation of ItemHeight property of CheckedListBox is,

public override int ItemHeight { 
        get {
            // this should take FontHeight + buffer into Consideration.
            return Font.Height + 2;
        set {

you can cleanly override this property in a new class.

public sealed class  MyListBox:CheckedListBox
        public MyListBox()
            ItemHeight = 30;
        public override int ItemHeight { get; set; }

this should allow you to set your own ItemHeight.

enter image description here