示例#1
0
        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);
                }
            }
        }
        void AddFileToListBox(string path)
        {
            XInfo listitem = new XInfo(XImage.LoadImagebyExt(path), XPath.GetFileNameWithoutExtension(path), path);

            listBox_timkiem.Invoke((Action)(() =>
            {
                listBox_timkiem.BeginUpdate();
                listBox_timkiem.Items.Add(listitem);
                listBox_timkiem.EndUpdate();
            }));
        }
示例#3
0
        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);
            }
        }
示例#4
0
 void loadLichsuFile()
 {
     string[] result = XTxt.ReadLineText(XPath.pathfile_history_file).ToArray();
     if (result.Count() == 0)
     {
         listBox_file.DrawMode = DrawMode.Normal;
         listBox_file.Items.Add("Không có file mở gần đây");
     }
     else
     {
         foreach (string item in result)
         {
             XInfo temp = new XInfo(item);
             listBox_file.Items.Add(temp);
         }
     }
 }