c# - DataGridViewCell Change Error Icon -


i using .net 4.0 , i'm looking way change error image in cell when error text set word "linked". want original error image display if other error text. i've tried setting image when set text unable so.

this have far:

protected override void oncellpainting(datagridviewcellpaintingeventargs e) {     if (e.errortext == "linked")     {         //image     }     else     {         base.oncellpainting(e);     } } 

p.s. i've never used overrides before i'm aware i'm doing maybe wrong. reading

you can try following code change error icon of datagridviewtextboxcell...

class datagridviewcell: datagridviewtextboxcell {         protected override void painterroricon(graphics graphics, rectangle clipbounds, rectangle cellvaluebounds, string errortext)         {             if(errortext == "linked")             {                 graphics.drawicon(systemicons.error, new rectangle(cellvaluebounds.width - 10, 0, 10, 10));             }             else              {                 // base method             }         }     } 

for more infomration click here...


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -