简体   繁体   English

自定义UserControl中的列表框大小严重调整

[英]Resizing listbox badly in custom UserControl

I made custom control and i want listbox to be at the bottom of it . 我做了自定义控件,我希望列表框位于它的底部。 Like on picture bellow: 就像下面的图片一样:
在此处输入图片说明
Only thing that i did is that i set dock property to bottom. 我唯一要做的就是将Dock属性设置为底部。 And that do my job , but soon i realised that , when im resizing my control vertically , listbox is not resizing well. 这样就完成了我的工作,但是很快我意识到,在垂直调整控件大小时,列表框的调整大小不好。
Here is picture 这是图片 在此处输入图片说明
Background color of my control is red , so listbox is not resizing well, i dont know why, but if i move control one more pixel down, the listbox would be moved nicely, but if i continue to move, it is same. 我的控件的背景颜色是红色,所以列表框的大小不能很好地调整,我不知道为什么,但是如果我将控件向下移动一个像素,则列表框将被很好地移动,但是如果我继续移动,它也是一样。

I discovered that every 11 pixels listbox resizes well, but on 12th , control is resizing , but listbox doesnt , again 我发现列表框每隔11个像素便会调整大小,但是在12日,控件将调整大小,但列表框却没有调整


Anybody knows why? 有人知道为什么吗?

Assuming this is WinForms, check the IntegralHeight property on the listbox. 假设这是WinForms,请检查列表框中的IntegralHeight属性。 When true, the listbox height will always be a multiple of the item height, which is probably what's causing the behavior you're seeing. 如果为true,则列表框高度将始终是项目高度的倍数,这可能是导致您所看到的行为的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM