Adding a legend for colors in ListView WinForms C# [closed]
Wan开发者_JS百科t to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this questionI have simple ListView
with few columns and it's populated with data with background colors. There's like 5 colors in use so I would like to nicely show them next to ListView
for easy reminder especially for people who list things once a month.
Are there some kind of guidelines how to proceed with this before I start to do it on my own (GroupBox
with Colored Labels
describing meaning comes to my mind next to ListView
)?
There are 101 ways of putting a legend together and a GroupbBox with colored Labels is just fine. The one consideration you should make though is whether the legend will need to be dynamic. I.e. will the colors ever need to change or be added to in the future. If yes, then you should code it so that it is dynamic. You can still use a group box and labels but assemble the legend according to a data model rather than static controls with hard coded colors.
For other considerations: you could make it a user control that can dragged and dropped onto a Form and expose properties such as colored label size (length/width), label font, margins etc.
精彩评论