How do I make a ListBox refresh its item text?

前端 未结 10 1989
后悔当初
后悔当初 2020-12-03 04:42

I\'m making an example for someone who hasn\'t yet realized that controls like ListBox don\'t have to contain strings; he had been storing formatted strings and

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 05:05

    If you derive from ListBox there is the RefreshItem protected method you can call. Just re-expose this method in your own type.

    public class ListBox2 : ListBox {
        public void RefreshItem2(int index) {
            RefreshItem(index);
        }
    }
    

    Then change your designer file to use your own type (in this case, ListBox2).

提交回复
热议问题