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 } } }
Comments
Post a Comment