private void listBox_timkiem_DrawItem(object sender, DrawItemEventArgs e) { if (e.Index >= 0) { ListBox listBox = sender as ListBox; string path = listBox.Items[e.Index] as string; if (rd_TXT.Checked) { string lineresult = XTxt.GetLineHaveKeyWord(path, keyword); XTextInfo fileInfo = new XTextInfo(path, lineresult); // Draw the background. e.DrawBackground(); fileInfo.DrawItem(e.Graphics, e.Bounds, this.Font, false); } else if (rd_word.Checked) { XInfo fileInfo = new XInfo(path); // Draw the background. e.DrawBackground(); fileInfo.DrawItem(e.Graphics, e.Bounds, this.Font, false); } } }
private void ListBox_file_DrawItem(object sender, DrawItemEventArgs e) { ListBox listBox = sender as ListBox; if (e.Index >= 0) { XInfo fileInfo = listBox.Items[e.Index] as XInfo; // Draw the background. e.DrawBackground(); fileInfo.DrawItem(e.Graphics, e.Bounds, this.Font, false); } }