0
Answer

Pen Color Change

nitinwebdev

nitinwebdev

20y
3.9k
1
I am drawing lines of different colors based on a criteria. I have an If Else loop and when the panel paint event is called it selects the color specified in the else statement by default. Kinda overrides the color in the if statement. So all the lines turn out be blue. Here is the code: foreach(Line l in Lines) { if(locallink!=null) { char charfileindex1='#'; int charfileindexlen1=locallink.Split(charfileindex1).Length; string[] ss=new string[charfileindexlen1]; ss=locallink.Split(charfileindex1); for(int i=0; i { //int index=ss[i].IndexOf(dragimage); if(checklinks(ss[i].ToString())> 0) { //draws red line DrawAssocLine(l); label4.Text="Red"+k.ToString(); k++; } else { //draws blue line DrawLine(l); label5.Text="Blue"+m.ToString(); m++; } } } } Region r = getRegionByLine(line,p); thumbnailpanel.Invalidate(r); thumbnailpanel.Update(); r.Dispose();