/[dotgnu-pnet]/pnetlib/System.Windows.Forms/DataGrid.cs
ViewVC logotype

Diff of /pnetlib/System.Windows.Forms/DataGrid.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by drobosson, Mon Sep 26 02:19:12 2005 UTC revision 1.3 by drobosson, Mon Sep 26 12:18:31 2005 UTC
# Line 37  namespace System.Windows.Forms Line 37  namespace System.Windows.Forms
37                  public DataGridColumnStyle gridColumn;                  public DataGridColumnStyle gridColumn;
38                  public System.Drawing.Rectangle bounds;                  public System.Drawing.Rectangle bounds;
39    
40                  private HScrollBar _hScrollBar;                  private HScrollBar hScrollBar;
41                  private VScrollBar _vScrollBar;                  private VScrollBar vScrollBar;
42    
43                  private BorderStyle _borderStyle;                  private BorderStyle borderStyle;
44                                    
45                  private bool _initializing;                  private bool initializing;
46                  private bool _captionVisible = true;                  private bool captionVisible = true;
47                  private bool _columnHeadersVisible = true;                  private bool columnHeadersVisible = true;
48                  private bool _rowHeadersVisible = true;                  private bool rowHeadersVisible = true;
49                  private bool _allowNavigation = true;                  private bool allowNavigation = true;
50                  private bool _allowSorting = true;                  private bool allowSorting = true;
51    
52                  private String _dataMember= "";                  private String dataMember= "";
53                  private String _text = "";                  private String captionText = "";
54                  private String _captionText = "";  
55                    private int rowHeight;
56                  private int _rowHeight;                  private int columnWidth;
57                  private int _columnWidth;                  private int rows;
58                  private int _rows;                  private int columns;
59                  private int _columns;                  private int row;
60                  private int _row;                  private int col;
61                  private int _col;                  private int numEntries = 1;
62                  private int _numEntries = 1;                  private int textHeight;
63                  private int _textHeight;                  private int leftMostColumn;
64                  private int _leftMostColumn;                  private int selected;
65                  private int _selected;                  private int columnSpacing;
66                  private int _columnSpacing;                  private int currentRowIndex;
67                  private int _currentRowIndex;                  private int preferredColumnWidth = 75;
68                  private int _preferredColumnWidth = 75;                  private int preferredRowHeight = 16;
69                  private int _preferredRowHeight = 16;                  private int rowHeaderWidth = 35;
70                  private int _rowHeaderWidth = 35;  
71                    private Font captionFont;
72                  private Font _captionFont;                  private Font headerFont;
73                  private Font _headerFont;  
74                    private Color dgforeColor;
75                  private Color _foreColor;                  private Color backgroundColor;
76                  private Color _backgroundColor;                  private Color headerBackColor;
77                  private Color _headerBackColor;                  private Color dgbackColor;
78                  private Color _backColor;                  private Color headerForeColor;
79                  private Color _headerForeColor;                  private Color captionBackColor;
80                  private Color _captionBackColor;                  private Color captionForeColor;
81                  private Color _captionForeColor;                  private Color gridLineColor;
82                  private Color _gridLineColor;                  private Color alternatingBackColor;
                 private Color _alternatingBackColor;  
83                                    
84                  private Image _backgroundImage;                  private Image backgroundImage;
85                                    
86                  private System.Object _dataSource;                  private System.Object dataSource;
87                                    
88                  private TextBox _textBox;                  private TextBox textBox;
89    
90                  private DataGridCell _currentCell;                  private DataGridCell currentCell;
91                  private DataGridCell _editCell;                  private DataGridCell editCell;
92                                    
93                  private GridTableStylesCollection _gridTableStylesCollection;                  private GridTableStylesCollection gridTableStylesCollection;
94                  // Constructor                  // Constructor
95                  public DataGrid()                  public DataGrid()
96                  {                  {
# Line 99  namespace System.Windows.Forms Line 98  namespace System.Windows.Forms
98    
99                          SetStyle(ControlStyles.ResizeRedraw,true);                          SetStyle(ControlStyles.ResizeRedraw,true);
100                          SetStyle(ControlStyles.DoubleBuffer, true);                          SetStyle(ControlStyles.DoubleBuffer, true);
101                          _initializing = true;                          initializing = true;
102                          _gridTableStylesCollection= new GridTableStylesCollection();                          gridTableStylesCollection= new GridTableStylesCollection();
103                          _gridTableStylesCollection.Add(new DataGridTableStyle());                          gridTableStylesCollection.Add(new DataGridTableStyle());
104                          _foreColor = SystemColors.WindowText;                          dgforeColor = SystemColors.WindowText;
105                          _backgroundColor = SystemColors.Window;                          backgroundColor = SystemColors.Window;
106                          _headerForeColor = SystemColors.WindowText;                          headerForeColor = SystemColors.WindowText;
107                          _hScrollBar = new HScrollBar();                          hScrollBar = new HScrollBar();
108                          _hScrollBar.Visible = false;                          hScrollBar.Visible = false;
109                          _hScrollBar.Dock = DockStyle.Bottom;                          hScrollBar.Dock = DockStyle.Bottom;
110                          _hScrollBar.TabStop = false;                          hScrollBar.TabStop = false;
111                          _hScrollBar.ValueChanged += new EventHandler(GridHScrolled);                          hScrollBar.ValueChanged += new EventHandler(GridHScrolled);
112                          _vScrollBar = new VScrollBar();                          vScrollBar = new VScrollBar();
113                          _vScrollBar.Visible = false;                          vScrollBar.Visible = false;
114                          _vScrollBar.Dock = DockStyle.Right;                          vScrollBar.Dock = DockStyle.Right;
115                          _vScrollBar.TabStop = false;                          vScrollBar.TabStop = false;
116                          _vScrollBar.ValueChanged += new EventHandler(GridVScrolled);                          vScrollBar.ValueChanged += new EventHandler(GridVScrolled);
117                          Controls.Add(_vScrollBar);                          Controls.Add(vScrollBar);
118                          Controls.Add(_hScrollBar);                          Controls.Add(hScrollBar);
119                  }                  }
120    
121                  [TODO]                  [TODO]
# Line 386  namespace System.Windows.Forms Line 385  namespace System.Windows.Forms
385                          {                          {
386  //                              Console.Write("D");  //                              Console.Write("D");
387                                  // Need to fill bg...                                  // Need to fill bg...
388                                  SolidBrush b = new SolidBrush(_backgroundColor);                                  SolidBrush b = new SolidBrush(backgroundColor);
389                                  g.FillRectangle(b, 0, 0, Width, Height);                                  g.FillRectangle(b, 0, 0, Width, Height);
390                                  System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);                                  System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);
391                                  Size s = ClientSize;                                  Size s = ClientSize;
392                                  //Rectangle rect = new Rectangle(drawableWidth + xOffset, 1, _vScrollBar.Width, clientRectangle.Height);                                  //Rectangle rect = new Rectangle(drawableWidth + xOffset, 1, vScrollBar.Width, clientRectangle.Height);
393                                  Rectangle rect = new Rectangle(0, 0, _hScrollBar.Width - _vScrollBar.Width,_vScrollBar.Height);                                  Rectangle rect = new Rectangle(0, 0, hScrollBar.Width - vScrollBar.Width,vScrollBar.Height);
394                                  _hScrollBar.Visible = false;                                  hScrollBar.Visible = false;
395                                  _vScrollBar.Visible = false;                                  vScrollBar.Visible = false;
396                                  //g.FillRectangle(myBrush, rect);                                  //g.FillRectangle(myBrush, rect);
397                                  Pen     Black = new Pen(Color.Black);                                  Pen     Black = new Pen(Color.Black);
398                                  g.DrawRectangle(Black, rect);                                  g.DrawRectangle(Black, rect);
399                                  Pen     txtPen = new Pen(Color.Black);                                  Pen     txtPen = new Pen(Color.Black);
400                                  g.DrawLine(txtPen,_vScrollBar.Width/2,_vScrollBar.Width, 0, _vScrollBar.Width);                                  g.DrawLine(txtPen,vScrollBar.Width/2,vScrollBar.Width, 0, vScrollBar.Width);
401                                  //g.ExcludeClip(rect);                                  //g.ExcludeClip(rect);
402                          }                          }
403                  }                  }
# Line 421  namespace System.Windows.Forms Line 420  namespace System.Windows.Forms
420                  protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)                  protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
421                  {                  {
422                          base.OnMouseDown(e);                          base.OnMouseDown(e);
423                          this._backgroundColor = Color.Beige;                          this.backgroundColor = Color.Beige;
424  //                      Console.Write("M");  //                      Console.Write("M");
425                  }                  }
426    
# Line 477  namespace System.Windows.Forms Line 476  namespace System.Windows.Forms
476                  {                  {
477                                                    
478                          base.OnPaintBackground (ebe);                          base.OnPaintBackground (ebe);
479                          using (Brush back = new SolidBrush(_backgroundColor))                          using (Brush back = new SolidBrush(backgroundColor))
480                          {                          {
481                                  ebe.Graphics.FillRectangle(back, 0, 0, Width, Height);                                  ebe.Graphics.FillRectangle(back, 0, 0, Width, Height);
482                          }                          }
# Line 975  namespace System.Windows.Forms Line 974  namespace System.Windows.Forms
974                  {                  {
975                          get                          get
976                          {                          {
977                                  return this._allowNavigation;                                  return this.allowNavigation;
978                          }                          }
979    
980                          set                          set
981                          {                          {
982                                  if(this._allowNavigation != value) {                                  if(this.allowNavigation != value) {
983                                          this._allowNavigation = value;                                          this.allowNavigation = value;
984                                          // OnAllowNavigationChanged event should be fired                                          // OnAllowNavigationChanged event should be fired
985                                  }                                  }
986                          }                          }
# Line 993  namespace System.Windows.Forms Line 992  namespace System.Windows.Forms
992                  {                  {
993                          get                          get
994                          {                          {
995                                  return this._allowSorting;                                  return this.allowSorting;
996                          }                          }
997    
998                          set                          set
999                          {                          {
1000                                  this._allowSorting = value;                                  this.allowSorting = value;
1001                          }                          }
1002    
1003                  }                  }
# Line 1008  namespace System.Windows.Forms Line 1007  namespace System.Windows.Forms
1007                  {                  {
1008                          get                          get
1009                          {                          {
1010                                  return this._alternatingBackColor;                                  return this.alternatingBackColor;
1011                          }                          }
1012    
1013                          set                          set
1014                          {                          {
1015                                  this._alternatingBackColor = value;                                  this.alternatingBackColor = value;
1016                          }                          }
1017    
1018                  }                  }
# Line 1022  namespace System.Windows.Forms Line 1021  namespace System.Windows.Forms
1021                  {                  {
1022                          get                          get
1023                          {                          {
1024                                  return this._backColor;                                  return this.dgbackColor;
1025                          }                          }
1026    
1027                          set                          set
1028                          {                          {
1029                                  this._backColor = value;                                  this.dgbackColor = value;
1030                          }                          }
1031    
1032                  }                  }
# Line 1037  namespace System.Windows.Forms Line 1036  namespace System.Windows.Forms
1036                  {                  {
1037                          get                          get
1038                          {                          {
1039                                  return this._backgroundColor;                                  return this.backgroundColor;
1040                          }                          }
1041    
1042                          set                          set
1043                          {                          {
1044                                  this._backgroundColor = value;                                  this.backgroundColor = value;
1045                          }                          }
1046    
1047                  }                  }
# Line 1052  namespace System.Windows.Forms Line 1051  namespace System.Windows.Forms
1051                  {                  {
1052                          get                          get
1053                          {                          {
1054                                  return this._backgroundImage;                                  return this.backgroundImage;
1055                          }                          }
1056    
1057                          set                          set
1058                          {                          {
1059                                  this._backgroundImage = value;                                  this.backgroundImage = value;
1060                          }                          }
1061    
1062                  }                  }
# Line 1067  namespace System.Windows.Forms Line 1066  namespace System.Windows.Forms
1066                  {                  {
1067                          get                          get
1068                          {                          {
1069                                  return this._borderStyle;                                  return this.borderStyle;
1070                          }                          }
1071    
1072                          set                          set
1073                          {                          {
1074                                  this._borderStyle = value;                                  this.borderStyle = value;
1075                          }                          }
1076    
1077                  }                  }
# Line 1082  namespace System.Windows.Forms Line 1081  namespace System.Windows.Forms
1081                  {                  {
1082                          get                          get
1083                          {                          {
1084                                  return this._captionBackColor;                                  return this.captionBackColor;
1085                          }                          }
1086    
1087                          set                          set
1088                          {                          {
1089                                  this._captionBackColor = value;                                  this.captionBackColor = value;
1090                          }                          }
1091    
1092                  }                  }
# Line 1097  namespace System.Windows.Forms Line 1096  namespace System.Windows.Forms
1096                  {                  {
1097                          get                          get
1098                          {                          {
1099                                  return this._captionFont;                                  return this.captionFont;
1100                          }                          }
1101    
1102                          set                          set
1103                          {                          {
1104                                  this._captionFont = value;                                  this.captionFont = value;
1105                          }                          }
1106    
1107                  }                  }
# Line 1112  namespace System.Windows.Forms Line 1111  namespace System.Windows.Forms
1111                  {                  {
1112                          get                          get
1113                          {                          {
1114                                  return this._captionForeColor;                                  return this.captionForeColor;
1115                          }                          }
1116    
1117                          set                          set
1118                          {                          {
1119                                  this._captionForeColor = value;                                  this.captionForeColor = value;
1120                          }                          }
1121    
1122                  }                  }
# Line 1127  namespace System.Windows.Forms Line 1126  namespace System.Windows.Forms
1126                  {                  {
1127                          get                          get
1128                          {                          {
1129                                  return this._captionText;                                  return this.captionText;
1130                          }                          }
1131    
1132                          set                          set
1133                          {                          {
1134                                  this._captionText = value;                                  this.captionText = value;
1135                          }                          }
1136    
1137                  }                  }
# Line 1142  namespace System.Windows.Forms Line 1141  namespace System.Windows.Forms
1141                  {                  {
1142                          get                          get
1143                          {                          {
1144                                  return this._captionVisible;                                  return this.captionVisible;
1145                          }                          }
1146    
1147                          set                          set
1148                          {                          {
1149                                  this._captionVisible = value;                                  this.captionVisible = value;
1150                          }                          }
1151    
1152                  }                  }
# Line 1157  namespace System.Windows.Forms Line 1156  namespace System.Windows.Forms
1156                  {                  {
1157                          get                          get
1158                          {                          {
1159                                  return this._columnHeadersVisible;                                  return this.columnHeadersVisible;
1160                          }                          }
1161    
1162                          set                          set
1163                          {                          {
1164                                  this._columnHeadersVisible = value;                                  this.columnHeadersVisible = value;
1165                          }                          }
1166    
1167                  }                  }
# Line 1187  namespace System.Windows.Forms Line 1186  namespace System.Windows.Forms
1186                  {                  {
1187                          get                          get
1188                          {                          {
1189                                  return this._currentRowIndex;                                  return this.currentRowIndex;
1190                          }                          }
1191    
1192                          set                          set
1193                          {                          {
1194                                  this._currentRowIndex = value;                                  this.currentRowIndex = value;
1195                          }                          }
1196    
1197                  }                  }
# Line 1216  namespace System.Windows.Forms Line 1215  namespace System.Windows.Forms
1215                  {                  {
1216                          get                          get
1217                          {                          {
1218                                  return this._dataMember;                                  return this.dataMember;
1219                          }                          }
1220    
1221                          set                          set
1222                          {                          {
1223                                  this._dataMember = value;                                  this.dataMember = value;
1224                          }                          }
1225    
1226                  }                  }
# Line 1231  namespace System.Windows.Forms Line 1230  namespace System.Windows.Forms
1230                  {                  {
1231                          get                          get
1232                          {                          {
1233                                  return this._dataSource;                                  return this.dataSource;
1234                          }                          }
1235    
1236                          set                          set
1237                          {                          {
1238                                  this._dataSource = value;                                  this.dataSource = value;
1239                          }                          }
1240    
1241                  }                  }
# Line 1280  namespace System.Windows.Forms Line 1279  namespace System.Windows.Forms
1279                  {                  {
1280                          get                          get
1281                          {                          {
1282                                  return this._foreColor;                                  return this.dgforeColor;
1283                          }                          }
1284    
1285                          set                          set
1286                          {                          {
1287                                  this._foreColor = value;                                  this.dgforeColor = value;
1288                          }                          }
1289    
1290                  }                  }
# Line 1295  namespace System.Windows.Forms Line 1294  namespace System.Windows.Forms
1294                  {                  {
1295                          get                          get
1296                          {                          {
1297                                  return this._gridLineColor;                                  return this.gridLineColor;
1298                          }                          }
1299    
1300                          set                          set
1301                          {                          {
1302                                  this._gridLineColor = value;                                  this.gridLineColor = value;
1303                          }                          }
1304    
1305                  }                  }
# Line 1325  namespace System.Windows.Forms Line 1324  namespace System.Windows.Forms
1324                  {                  {
1325                          get                          get
1326                          {                          {
1327                                  return this._headerBackColor;                                  return this.headerBackColor;
1328                          }                          }
1329    
1330                          set                          set
1331                          {                          {
1332                                  this._headerBackColor = value;                                  this.headerBackColor = value;
1333                          }                          }
1334    
1335                  }                  }
# Line 1340  namespace System.Windows.Forms Line 1339  namespace System.Windows.Forms
1339                  {                  {
1340                          get                          get
1341                          {                          {
1342                                  return this._headerFont;                                  return this.headerFont;
1343                          }                          }
1344    
1345                          set                          set
1346                          {                          {
1347                                  this._headerFont = value;                                  this.headerFont = value;
1348                          }                          }
1349    
1350                  }                  }
# Line 1354  namespace System.Windows.Forms Line 1353  namespace System.Windows.Forms
1353                  {                  {
1354                          get                          get
1355                          {                          {
1356                                  return _headerForeColor;                                  return headerForeColor;
1357                          }                          }
1358    
1359                          set                          set
1360                          {                          {
1361                                  _headerForeColor = value;                                  headerForeColor = value;
1362                          }                          }
1363    
1364                  }                  }
# Line 1514  namespace System.Windows.Forms Line 1513  namespace System.Windows.Forms
1513                  {                  {
1514                          get                          get
1515                          {                          {
1516                                  return this._preferredColumnWidth;                                  return this.preferredColumnWidth;
1517                          }                          }
1518    
1519                          set                          set
1520                          {                          {
1521                                  this._preferredColumnWidth = value;                                  this.preferredColumnWidth = value;
1522                          }                          }
1523    
1524                  }                  }
# Line 1529  namespace System.Windows.Forms Line 1528  namespace System.Windows.Forms
1528                  {                  {
1529                          get                          get
1530                          {                          {
1531                                  return this._preferredRowHeight;                                  return this.preferredRowHeight;
1532                          }                          }
1533    
1534                          set                          set
1535                          {                          {
1536                                  this._preferredRowHeight = value;                                  this.preferredRowHeight = value;
1537                          }                          }
1538    
1539                  }                  }
# Line 1559  namespace System.Windows.Forms Line 1558  namespace System.Windows.Forms
1558                  {                  {
1559                          get                          get
1560                          {                          {
1561                                  return this._rowHeaderWidth;                                  return this.rowHeaderWidth;
1562                          }                          }
1563    
1564                          set                          set
1565                          {                          {
1566                                  this._rowHeaderWidth = value;                                  this.rowHeaderWidth = value;
1567                          }                          }
1568    
1569                  }                  }
# Line 1574  namespace System.Windows.Forms Line 1573  namespace System.Windows.Forms
1573                  {                  {
1574                          get                          get
1575                          {                          {
1576                                  return this._rowHeadersVisible;                                  return this.rowHeadersVisible;
1577                          }                          }
1578    
1579                          set                          set
1580                          {                          {
1581                                  this._rowHeadersVisible = value;                                  this.rowHeadersVisible = value;
1582                          }                          }
1583    
1584                  }                  }
# Line 1634  namespace System.Windows.Forms Line 1633  namespace System.Windows.Forms
1633                  {                  {
1634                          get                          get
1635                          {                                {      
1636                                  return this._gridTableStylesCollection;                                  return this.gridTableStylesCollection;
1637                          }                          }
1638    
1639                  }                  }
# Line 1699  namespace System.Windows.Forms Line 1698  namespace System.Windows.Forms
1698    
1699                  public sealed class HitTestInfo                  public sealed class HitTestInfo
1700                  {                  {
1701                          internal int _column;                          internal int column;
1702                          internal int _row;                          internal int row;
1703                                    
1704                          public static readonly DataGrid.HitTestInfo Nowhere = null;                          public static readonly DataGrid.HitTestInfo Nowhere = null;
1705    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26