c# - Formatting Text in a ListView? -
i'm creating little app read, parse, , format contents of lua script - specifically, savedvariables file world of warcraft created "elephant" chat logging add-on. prototype have in mind generate array of listviewitem instances, showing timestamp, player name, channel message posted into, , message posted.
i'd have chat message rendered in game: game colors names of "talking" in chat after character's class (e.g. rogue's name yellow, mages' names light blue), when comes listviewitem , listviewsubitem, coloring text there seems all-or-nothing deal.
would possible add functionality listview apply formatting (or color) text in listviewitem or listviewsubitem based on markup in text property?
edit: i'm asking if it's possible add text formatting listviewitem through magic of inheritance/polymorphism in derived class, , if so, what's best way (amount of effort, code security, etc)?
speaking windows forms usage view point, can render items manually. should consider situations such as: how should text rendered when text exceeds bounds of control/column?
this requires inherit listview; can render each item using:
protected override void ondrawitem(drawlistviewitemeventargs e) of course, ownerdraw must set true. drawlistviewitemeventargs contains text needs rendered , graphics instance should used render text. use drawstring(string s, font font, brush brush, float x, float y) render each part of text required mark-up convention.
if don't mind gpl, objectlistview offer more formatting options perhaps not flexible require.
since richtextbox allows flexible text formatting, wonder if somehow used renderer...
Comments
Post a Comment