[英]Create spaces between check boxes
我有一個清單框,當我填充它時,我希望每個復選框之間都有一個空白空間。 我可以用空字符串創建它們,但復選框仍然存在。 誰能幫幫我嗎。
謝謝
假設您正在使用.NET C#winforms ...
您可以繼承此控件,並重寫屬性.ItemHeight
,如下所示:
private class OverriddenCheckedListBox : CheckedListBox
{
public override int ItemHeight { get; set; }
}
將這些控件之一放在窗體上,然后將屬性設置為適合所需空間的高度。 (如果希望它顯示在工具箱中,則需要將其創建為用戶控件。)以下是一個示例:
OverriddenCheckedListBox ochkListBox = new OverriddenCheckedListBox();
ochkListBox.Location = new Point(0, 0);
ochkListBox.Dock = DockStyle.Fill;
ochkListBox.Items.Add("Alpha");
ochkListBox.Items.Add("Beta");
ochkListBox.Items.Add("Charlie");
ochkListBox.Items.Add("Delta");
ochkListBox.Items.Add("Epsilon");
ochkListBox.ItemHeight = 30; // This is your row height
this.Controls.Add(ochkListBox);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.