View Full Version : DotNet Listview : Make line BOLD

04 April 2008, 12:24 AM
I've been frustrated by something simple I'm just not getting...

I've a dotNetObject:System.Windows.Forms.ListViewItem with a non-changable property .font.bold

How do I construct this item, so I can change the prop to BOLD?


04 April 2008, 01:45 AM
assign a new font to the item

newFont = dotNetObject "System.Drawing.Font" \
"Microsoft Sans Serif" \ -- font name
11 \ -- font size (in piels)
(dotNetClass "System.Drawing.FontStyle").Bold \ -- font style (bold)
(dotNetClass "System.Drawing.GraphicsUnit").Pixel -- specify size is in pixels
listview_rollout.lv_objects.items.item[0].font = newFont

See also:

04 April 2008, 05:43 AM
I shouldv'e known.... Thanks :-)

04 April 2008, 09:51 AM
lol, yes :)

Actually, the biggest bit is "assign a new font". Once you realize that bit, the question becomes "so how the heck do I make a new font?", and Google becomes your friend :)

I agree that it's weird that you can't just change the .bold property to true; but that's .NET for ya

CGTalk Moderation
04 April 2008, 09:51 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.