예제 #1
0
        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }
            string name     = listBox1.Items[e.Index].ToString();
            CBook  book     = FormChess.bookList.GetBook(name);
            bool   selected = (e.State & DrawItemState.Selected) == DrawItemState.Selected;
            Brush  b        = Brushes.Black;

            if (selected)
            {
                e = new DrawItemEventArgs(e.Graphics, e.Font, e.Bounds, e.Index, e.State ^ DrawItemState.Selected, CBoard.colorMessage, CBoard.colorChartD);
                b = Brushes.White;
            }
            else if (!book.FileExists())
            {
                e = new DrawItemEventArgs(e.Graphics, e.Font, e.Bounds, e.Index, e.State, Color.White, CBoard.colorRed);
                b = Brushes.White;
            }
            e.DrawBackground();
            e.Graphics.DrawString(name, e.Font, b, e.Bounds, StringFormat.GenericDefault);
            e.DrawFocusRectangle();
        }
예제 #2
0
 void TryDel(string dir)
 {
     for (int n = list.Count - 1; n >= 0; n--)
     {
         CBook book = list[n];
         if (book.parameters.IndexOf(dir) == 0)
         {
             if (!book.FileExists() || !book.ParametersExists())
             {
                 DeleteBook(book.name);
             }
         }
     }
 }