Пример #1
0
        private void setColors()
        {
            if (_colorStyle == XColorStyle.Blue)
            {
                _colors = new XBlue();
            }
            else if (_colorStyle == XColorStyle.Red)
            {
                _colors = new XRed();
            }

            this.BackColor = _colors.getBackgroundColor();
            this.ForeColor = _colors.getForeColor();
            this.FlatAppearance.BorderColor        = _colors.getBorderColor();
            this.FlatAppearance.MouseOverBackColor = _colors.getHoverColor();
            this.FlatAppearance.MouseDownBackColor = _colors.getBorderColor();
        }
Пример #2
0
        private DataGridViewCellStyle GenerateCellStyle(bool isAlternate)
        {
            DataGridViewCellStyle cellStyle = new DataGridViewCellStyle();

            cellStyle.Alignment          = DataGridViewContentAlignment.MiddleLeft;
            cellStyle.BackColor          = isAlternate ? Color.FromArgb(42, 42, 44) : Color.FromArgb(45, 45, 48);
            cellStyle.Font               = new Font("Segoe UI", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            cellStyle.ForeColor          = Color.White;
            cellStyle.SelectionBackColor = _colors.getBorderColor();
            cellStyle.SelectionForeColor = Color.White;
            return(cellStyle);
        }
Пример #3
0
 private void DoDrawItem(object sender, DrawItemEventArgs e)
 {
     if (e == null || e.Index < 0)
     {
         return;
     }
     //if the item state is selected them change the back color
     if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
     {
         e = new DrawItemEventArgs(e.Graphics,
                                   e.Font,
                                   e.Bounds,
                                   e.Index,
                                   e.State ^ DrawItemState.Selected,
                                   e.ForeColor,
                                   _colors.getBorderColor());//Choose the color
     }
     // Draw the background of the ListBox control for each item.
     e.DrawBackground();
     // Draw the current item text
     e.Graphics.DrawString(this.Items[e.Index].ToString(), this.Font, new SolidBrush(this.ForeColor), e.Bounds, StringFormat.GenericDefault);
     // If the ListBox has focus, draw a focus rectangle around the selected item.
     e.DrawFocusRectangle();
 }
Пример #4
0
 protected override void OnPaint(PaintEventArgs e)
 {
     using (SolidBrush brush = new SolidBrush(BackColor))
         e.Graphics.FillRectangle(brush, ClientRectangle);
     e.Graphics.DrawRectangle(new Pen(_colors.getBorderColor()), 0, 0, ClientSize.Width - 1, ClientSize.Height - 1);
 }