I have a UserComboBox ucb on page.
private CheckedListBox cklb = new CheckedListBox();
ubc.DropDownControl = cklb;
The problem is that the autosize of CheckedListBox is faulty (width is smaller than content). I tried to set cklb.Width manually, but with no effect. How can I modify the width (/height) of cklb?
The drop down control is the same size as the combobox at a minimum or wider if you set the MinimumSize of the control because it’s the standard behavior of the regular ComboBox.
There is no horizontal autosizing in the ListBox or CheckedListBox. Use TextUtils.MeasureText() if you want to calculate the size of the text. See attached fixed sample setting the width 300.
cklb.MinimumSize = new System.Drawing.Size(300, 0);
Attached the files. Put it simple:
private CheckedListBox cklb = new CheckedListBox();
private void Window1_Load(object sender, EventArgs e)
{
cklb.Items.Add(“text 1”);
cklb.Items.Add(“text 2”);
cklb.Items.Add(“a (much) longer text”);
cklb.Items.Add(“text 3”);
cklb.Items.Add(“text 4”);
cklb.Items.Add(“text 5”);
cklb.Items.Add(“text 6”);
cklb.Items.Add(“text 6”);
cbTest.DropDownControl = cklb;
}
See screenshot. The longer text is not shown completely. That is what I want to correct.
Hi Adrian
Can you please, send us a little sample for check exactly what do you want ?
Best regards
Please login first to submit.