System.Windows.Forms.ThemeWin32Classic.DataGridPaintRows C# (CSharp) Method

DataGridPaintRows() public method

public DataGridPaintRows ( Graphics g, Rectangle cells, Rectangle clip, System.Windows.Forms.DataGrid grid ) : void
g System.Drawing.Graphics
cells System.Drawing.Rectangle
clip System.Drawing.Rectangle
grid System.Windows.Forms.DataGrid
return void
		public override void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid)
		{
			Rectangle rect_row = new Rectangle ();
			Rectangle not_usedarea = new Rectangle ();

			int rowcnt = grid.VisibleRowCount;
			
			bool showing_add_row = false;

			if (grid.RowsCount < grid.DataGridRows.Length) {
				/* the table has an add row */

				if (grid.FirstVisibleRow + grid.VisibleRowCount >= grid.DataGridRows.Length) {
					showing_add_row = true;
				}
			}

			rect_row.Width = cells.Width + grid.RowHeadersArea.Width;
			for (int r = 0; r < rowcnt; r++) {
				int row = grid.FirstVisibleRow + r;
				if (row == grid.DataGridRows.Length - 1)
					rect_row.Height = grid.DataGridRows[row].Height;
				else
					rect_row.Height = grid.DataGridRows[row + 1].VerticalOffset - grid.DataGridRows[row].VerticalOffset;
				rect_row.Y = cells.Y + grid.DataGridRows[row].VerticalOffset - grid.DataGridRows[grid.FirstVisibleRow].VerticalOffset;
				if (clip.IntersectsWith (rect_row)) {
					if (grid.CurrentTableStyle.HasRelations
					    && !(showing_add_row && row == grid.DataGridRows.Length - 1))
						DataGridPaintRelationRow (g, row, rect_row, false, clip, grid);
					else
						DataGridPaintRow (g, row, rect_row, showing_add_row && row == grid.DataGridRows.Length - 1, clip, grid);
				}
			}

			not_usedarea.X = 0;
			// the rowcnt == 0 check is needed because
			// otherwise we'd draw over the caption on
			// empty datasources (since rect_row would be
			// Empty)
			if (rowcnt == 0)
				not_usedarea.Y = cells.Y;
			else
				not_usedarea.Y = rect_row.Y + rect_row.Height;
			not_usedarea.Height = cells.Y + cells.Height - rect_row.Y - rect_row.Height;
			not_usedarea.Width = cells.Width + grid.RowHeadersArea.Width;

			g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), not_usedarea);
		}
ThemeWin32Classic