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

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

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

javascript - Restarting Supervisor and effect on FlaskSocketIO -