Way to color parts of the Listbox/ListView line in C# WinForms?

前端 未结 2 500
刺人心
刺人心 2020-12-18 00:45
  1. Is there a way to color parts of ListBox Items (not only whole line)? For example listbox item consists of 5 words and only one is colored or 3 of 5.
  2. Is the
2条回答
  •  天命终不由人
    2020-12-18 01:03

    There is no built-in API which supports this type of modification to a WinForms ListBox or ListView. It is certainly possible to achieve this but the solution will involve a lot of custom painting and likely overriding WndProc. This will be a very involved and heavy solution.

    If this type of experience is important to your application I think you should very seriously consider WPF as a solution. WPF is designed to provide this type of eye candy and there are likely many samples on the web to get you up and running.

提交回复
热议问题