简体   繁体   English

从列表框C#中删除项目时将剪切项目

[英]Items are cut when remove item from listbox c#

I have a - Listbox that the property HorizontScrollBar = True ,So when I add a - item which text too long the scrollbar appears. 我有一个-列表框,其属性Horizo​​ntScrollBar = True,因此,当我添加-文本太长的滚动条时,它会出现。 My problem is that when I remove the 'long item' the other items' text is cut, the text is in Hebrew so I set the property RightToLeft = 'True' , When I change it to 'False' it's ok , but I don't want to set it to 'False'... 我的问题是,当我删除“长项目”时,其他项目的文本都被剪切掉了,该文本在希伯来语中,因此我将属性设置为RightToLeft ='True',当我将其更改为'False'时还可以,但是我不知道不想将其设置为“假” ... 在删除项目之前的列表框:

删除项目后的列表框:

Setting and resetting the RightToLeft property after the deletion operation fixes the problem. 删除操作后设置和重置RightToLeft属性可解决此问题。

listBox1.Items.RemoveAt(listBox1.Items.Count - 1);
listBox1.RightToLeft = RightToLeft.No;
listBox1.RightToLeft = RightToLeft.Yes;

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

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