private void UpdateBackColor()
        {
            Novel.NovelState state = Novel.State;

            if (state == Novel.NovelState.Active)
            {
                BackColor = Color.LightBlue;
                novelStateCB.BackColor = Color.LightBlue;
            }
            else if (state == Novel.NovelState.Inactive)
            {
                BackColor = Color.LightPink;
                novelStateCB.BackColor = Color.LightPink;
            }
            else if (state == Novel.NovelState.Completed)
            {
                BackColor = Color.LightGreen;
                novelStateCB.BackColor = Color.LightGreen;
            }
            else if (state == Novel.NovelState.Dropped)
            {
                BackColor = Color.LightGray;
                novelStateCB.BackColor = Color.LightGray;
            }
        }
Exemple #2
0
        private void ModifyCellStyle(int rowIndex)
        {
            DataGridViewRow row = dgvNovelList.Rows[rowIndex];

            Novel.NovelState state = (Novel.NovelState)Enum.Parse(typeof(Novel.NovelState), row.Cells["State"].Value.ToString());
            //bool isReading = NovelLibrary.Instance.GetNovel(row.Cells["NovelTitle"].Value.ToString()).Reading;

            if (state == Novel.NovelState.Active)
            {
                row.DefaultCellStyle.BackColor          = Color.LightBlue;
                row.DefaultCellStyle.SelectionBackColor = Color.SteelBlue;
            }
            else if (state == Novel.NovelState.Inactive)
            {
                row.DefaultCellStyle.BackColor          = Color.LightPink;
                row.DefaultCellStyle.SelectionBackColor = Color.Firebrick;
            }
            else if (state == Novel.NovelState.Completed)
            {
                row.DefaultCellStyle.BackColor          = Color.LightGreen;
                row.DefaultCellStyle.SelectionBackColor = Color.Green;
            }
            else if (state == Novel.NovelState.Dropped)
            {
                row.DefaultCellStyle.BackColor          = Color.LightGray;
                row.DefaultCellStyle.SelectionBackColor = Color.Gray;
            }
        }
        private void dgvNovelList_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            DataGridViewRow row = dgvNovelList.Rows[e.RowIndex];

            Novel.NovelState state     = (Novel.NovelState)Enum.Parse(typeof(Novel.NovelState), row.Cells["State"].Value.ToString());
            bool             isReading = NovelLibrary.Instance.GetNovel(row.Cells["NovelTitle"].Value.ToString()).Reading;
            int x      = e.RowBounds.Left + (penWidth / 2);
            int y      = e.RowBounds.Top + (penWidth / 2);
            int width  = e.RowBounds.Width - penWidth;
            int height = e.RowBounds.Height - penWidth;

            /*
             * if (isReading)
             *  e.Graphics.DrawRectangle(redPen, x, y, width, height);
             * else
             *  e.Graphics.DrawRectangle(whitePen, x, y, width, height);
             * Console.WriteLine("Drawing with " + e.RowIndex + " " + isReading);
             */
        }