i couldnt manage to change system.windows.forms.listbox item color,
do you know how to do that?
thanks.
serkan sendur
821
Postaholic
Banned
Recommended Answers
Jump to PostNice post.
Set DrawMode property and handle a DrawItem event.
Jump to Postwhat am i going to set the DrawMode to?
what is nice about the post?Dude, You know everything.
Jump to PostHere is a code.
private void Form1_Load(object sender, EventArgs e) { listBox1.Items.Add("First"); listBox1.Items.Add("Second"); listBox1.DrawMode = DrawMode.OwnerDrawFixed; listBox1.DrawItem += new DrawItemEventHandler(listBox1_DrawItem); } void listBox1_DrawItem(object sender, DrawItemEventArgs e) { e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), e.Font, Brushes.Red, e.Bounds); }
All 9 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
serkan sendur
821
Postaholic
Banned
kvprajapati
1,826
Posting Genius
Team Colleague
serkan sendur
821
Postaholic
Banned
kvprajapati
1,826
Posting Genius
Team Colleague
sknake
1,622
Senior Poster
Featured Poster
sknake
1,622
Senior Poster
Featured Poster
serkan sendur
821
Postaholic
Banned
serkan sendur
821
Postaholic
Banned
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.