1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
23 // Pedro MartÃnez Juliá <pedromj@gmail.com>
29 using System.ComponentModel;
32 namespace System.Windows.Forms {
34 public class DataGridViewRowPostPaintEventArgs : EventArgs {
36 private DataGridView dataGridView;
37 private Graphics graphics;
38 private Rectangle clipBounds;
39 private Rectangle rowBounds;
41 private DataGridViewElementStates rowState;
42 private string errorText;
43 private DataGridViewCellStyle inheritedRowStyle;
44 private bool isFirstDisplayedRow;
45 private bool isLastVisibleRow;
47 public DataGridViewRowPostPaintEventArgs (DataGridView dataGridView, Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, string errorText, DataGridViewCellStyle inheritedRowStyle, bool isFirstDisplayedRow, bool isLastVisibleRow) {
48 this.dataGridView = dataGridView;
49 this.graphics = graphics;
50 this.clipBounds = clipBounds;
51 this.rowBounds = rowBounds;
52 this.rowIndex = rowIndex;
53 this.rowState = rowState;
54 this.errorText = errorText;
55 this.inheritedRowStyle = inheritedRowStyle;
56 this.isFirstDisplayedRow = isFirstDisplayedRow;
57 this.isLastVisibleRow = isLastVisibleRow;
60 public Rectangle ClipBounds {
61 get { return clipBounds; }
62 set { clipBounds = value; }
65 public string ErrorText {
66 get { return errorText; }
69 public Graphics Graphics {
70 get { return graphics; }
73 public DataGridViewCellStyle InheritedRowStyle {
74 get { return inheritedRowStyle; }
77 public bool IsFirstDisplayedRow {
78 get { return isFirstDisplayedRow; }
81 public bool IsLastVisibleRow {
82 get { return isLastVisibleRow; }
85 public Rectangle RowBounds {
86 get { return rowBounds; }
90 get { return rowIndex; }
93 public DataGridViewElementStates State {
94 get { return rowState; }
97 public void DrawFocus (Rectangle bounds, bool cellsPaintSelectionBackground) {
98 if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
99 throw new InvalidOperationException("Invalid RowIndex.");
102 if (cellsPaintSelectionBackground) {
103 color = dataGridView.Rows[rowIndex].InheritedStyle.SelectionBackColor;
106 color = dataGridView.Rows[rowIndex].InheritedStyle.BackColor;
108 ///////// NOT CHECKED //////////////
109 graphics.FillRectangle(new SolidBrush(color), bounds);
112 public void PaintCells (Rectangle clipBounds, DataGridViewPaintParts paintParts) {
113 if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
114 throw new InvalidOperationException("Invalid RowIndex.");
116 throw new NotImplementedException();
119 public void PaintCellsBackground (Rectangle clipBounds, bool cellsPaintSelectionBackground) {
120 if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
121 throw new InvalidOperationException("Invalid RowIndex.");
124 if (cellsPaintSelectionBackground) {
125 color = dataGridView.Rows[rowIndex].InheritedStyle.SelectionBackColor;
128 color = dataGridView.Rows[rowIndex].InheritedStyle.BackColor;
130 ///////// NOT CHECKED //////////////
131 graphics.FillRectangle(new SolidBrush(color), clipBounds);
134 public void PaintCellsContent (Rectangle clipBounds) {
135 if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
136 throw new InvalidOperationException("Invalid RowIndex.");
138 throw new NotImplementedException();
141 public void PaintHeader (bool paintSelectionBackground) {
142 if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
143 throw new InvalidOperationException("Invalid RowIndex.");
146 if (paintSelectionBackground) {
147 color = dataGridView.Rows[rowIndex].InheritedStyle.SelectionBackColor;
150 color = dataGridView.RowHeadersDefaultCellStyle.BackColor;
152 ///////// NOT CHECKED //////////////
153 graphics.FillRectangle(new SolidBrush(color), clipBounds);
156 public void PaintHeader (DataGridViewPaintParts paintParts) {
157 if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
158 throw new InvalidOperationException("Invalid RowIndex.");
160 throw new NotImplementedException();