c# - Color item in a datagridview combobox column -


i have winform datagridview combobox column. possible color specific item in comboboxes? if yes, how can (in c#)?

use combobox1_drawitem

protected void combobox1_drawitem(object sender,      system.windows.forms.drawitemeventargs e) {      float size = 0;     system.drawing.font myfont;     fontfamily font= null;      //color , font based on index//     brush brush;     switch(e.index)     {         case 0:             size = 10;             brush = brushes.red;             family = font.genericsansserif;             break;         case 1:             size = 20;             brush = brushes.green;             font = font.genericmonospace;             break;     }      myfont = new font(font, size, fontstyle.bold);     string text = ((combobox)sender).items[e.index].tostring();     e.graphics.drawstring(text, myfont, brush, e.bounds.x, e.bounds.y); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -