/// <summary> /// Paints this <c>Propanel</c>. /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { Graphics graphics = e.Graphics; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; int offset = _scroll.Value; Rectangle rect; // fill the frozen-field(s) var/val-rect -> int c; for (c = 0; c != _grid.FrozenCount; ++c) { rect = new Rectangle(0, c * _heightr - offset, Width, _heightr); graphics.FillRectangle(Brushes.PropanelFrozen, rect); } // fill any selected cell's var/val-rect -> Cell sel = _grid.getSelectedCell(); if (sel != null) { rect = new Rectangle(0, sel.x * _heightr - offset, Width, _heightr); graphics.FillRectangle(Brushes.Selected, rect); } // fill the editor's val-rect if visible -> if (_editor.Visible) { rect = new Rectangle(); rect = _editRect; rect.Y -= offset; graphics.FillRectangle(Brushes.Editor, rect); } // draw vertical lines -> graphics.DrawLine(Pens.Black, // vertical left line 1, 0, 1, HeightProps - offset); graphics.DrawLine(Pencils.DarkLine, // vertical center line _widthVars, 1, _widthVars, HeightProps - offset - 1); graphics.DrawLine(Pencils.DarkLine, // vertical right line _widthVars + _widthVals, 1, _widthVars + _widthVals, HeightProps - offset - 1); graphics.DrawLine(Pens.Black, // horizontal top line 1, 1, Width, 1); graphics.DrawLine(Pens.Black, // horizontal bot line 1, _heightr * _grid.ColCount - offset, Width, _heightr * _grid.ColCount - offset); // draw horizontal lines -> int y; for (c = 1; c != _grid.ColCount; ++c) { y = _heightr * c - offset + 1; graphics.DrawLine(Pencils.DarkLine, 0, y, Width, y); } // draw var-texts -> rect = new Rectangle(_padHori, 0, _widthVars, _heightr); for (c = 0; c != _grid.ColCount; ++c) { rect.Y = _heightr * c - offset; TextRenderer.DrawText(graphics, _grid.Cols[c].text, Font, rect, Colors.Text, YataGraphics.flags); } // draw val-texts -> if (_grid.RangeSelect == 0) { int r = _grid.getSelectedRowOrCells(true); if (r != -1) { rect.X += _widthVars; rect.Width = _widthVals; for (c = 0; c != _grid.ColCount; ++c) { rect.Y = _heightr * c - offset; TextRenderer.DrawText(graphics, _grid[r, c].text, Font, rect, Colors.Text, YataGraphics.flags); } } } }