Beispiel #1
0
        public void StyleManagerStyleChanged(eDotNetBarStyle newStyle)
        {
            DGVScrollBar vsb = GetVScrollBar();
            if (vsb != null && vsb.Visible) vsb.Invalidate();

            DGHScrollBar hsb = GetHScrollBar();
            if (hsb != null && hsb.Visible) hsb.Invalidate();

            // Update Style
            Office2007ColorTable ct = null;
            if (GlobalManager.Renderer is Office2007Renderer)
            {
                ct = ((Office2007Renderer)GlobalManager.Renderer).ColorTable;
                m_ColorTable = ct.DataGridView;
                m_ButtonStateColorTable = ct.ButtonItemColors[0].Checked;
            }
            try // Don't like to do this but bug in GridColor setter requires it
            {
                if (!_UseCustomBackgroundColor)
                    this.BackgroundColor = m_ColorTable.BackgroundColor;
                this.ColumnHeadersDefaultCellStyle.ForeColor = m_ColorTable.ColumnHeaderNormalText;
                this.ColumnHeadersDefaultCellStyle.SelectionForeColor = m_ColorTable.ColumnHeaderSelectedText;
                this.DefaultCellStyle.BackColor = m_ColorTable.DefaultCellBackground;
                this.DefaultCellStyle.ForeColor = m_ColorTable.DefaultCellText;
                if (this.PaintEnhancedSelection)
                    this.DefaultCellStyle.SelectionForeColor = m_ButtonStateColorTable.Text;
                this.GridColor = m_ColorTable.GridColor;
                this.RowHeadersDefaultCellStyle.ForeColor = m_ColorTable.ColumnHeaderNormalText;
                this.RowHeadersDefaultCellStyle.SelectionForeColor = m_ColorTable.ColumnHeaderSelectedText;
                this.EnableHeadersVisualStyles = false;
            }
            catch { }
        }
Beispiel #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Office2007ColorTable ct = null;
            if (GlobalManager.Renderer is Office2007Renderer)
            {
                ct = ((Office2007Renderer)GlobalManager.Renderer).ColorTable;
                m_ColorTable = ct.DataGridView;
                m_ButtonStateColorTable = ct.ButtonItemColors[0].Checked;
            }

            if (this.CurrentCell != null)
                m_SelectedRowIndex = this.CurrentCell.RowIndex;
            else
                m_SelectedRowIndex = -1;

            base.OnPaint(e);

            if (this.VerticalScrollBar.Visible && this.HorizontalScrollBar.Visible)
            {
                Rectangle r = new Rectangle(this.VerticalScrollBar.Left, this.VerticalScrollBar.Bottom, this.VerticalScrollBar.Width, this.HorizontalScrollBar.Height);
                Color c = ct.AppScrollBar.Default.Background.End;
                if (c.IsEmpty) c = ct.AppScrollBar.Default.Background.Start;
                DisplayHelp.FillRectangle(e.Graphics, r, c);
                //e.Graphics.FillRectangle(Brushes.BlueViolet, r);
            }

            m_ColorTable = null;
            m_ButtonStateColorTable = null;
        }
Beispiel #3
0
 private void UpdateOffice2007Styles(Office2007DataGridViewColorTable ct)
 {
     if (this.GridColor != ct.GridColor)
         this.GridColor = ct.GridColor;
     if(m_PaintEnhancedSelection)
         this.DefaultCellStyle.SelectionForeColor = this.DefaultCellStyle.ForeColor;
 }