c# - How can i change the color of two lines in mouse down event? -


i have code:

private void scrolllabel1_mousedown(object sender, mouseeventargs e)         {             (int = 0; <  scrolllabel._lines.length; i++)             {              }         } 

_lines type of string[]

_lines format this:

first index 0 contain text: "hello" index 1 contain line of date , time: fri, 31 jan 2014 18:31:12 +0200

then index 2 empty line space: ""

then index 3 again text: "hi" index 4 again date , time: fri, 31 jan 2014 18:31:30 +0200

and os on there 151 lines.

what want when click(down) on line part of 2 lines text + date , time color both lines.

for example clicked on line in index 0 anywhere on line color index 0 , index 1 if clicked on line in index 2 empty nothing.

if click on line in index 3 or 4 color lines 3 , 4. if clicked on line 3 or 4 color both lines 3 , 4.

if clicked on line example 123 or 124 color both 123 , 124.

how can ?

scrolllabel usercontrol type label dragged form1 designer. , dosent have index selected event or that.

if i index of clicked line this:

int j = ((int)(i / 3)) * 3; colorline(j); colorline(j + 1); // colorline(j + 2); // not needed, line empty string 

the colorline() method should take care of coloring line of given index. should this:

private void colorline(int j) {     scrolllabel._lines[j] // put here code color line } 

how color line totally depends on line is. press . (dot) behind instance open intellisense , see methods , properties available. 1 allow coloring line. if not, coloring impossible , whole attempt impossible.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -