How to change color line in listbox by button c# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to change color line in listbox by button c#

I have an exercise to change the colors of line in listbox- wpf help me

12th Apr 2019, 12:03 PM
vy pham
vy pham - avatar
1 Answer
+ 1
You can use DrawItem event. private void yourlistBox_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); Graphics g = e.Graphics; g.FillRectangle(new SolidBrush(Color.Red), e.Bounds); // Print text e.DrawFocusRectangle(); } May that give you idea
13th Apr 2019, 7:12 AM
Andri Hry
Andri Hry - avatar