在好例子网,分享、交流、成长!
您当前所在位置:首页C# 开发实例桌面应用界面/GUI → DotNetBar的SuperGrid GridView实例源码

DotNetBar的SuperGrid GridView实例源码

桌面应用界面/GUI

下载此实例
  • 开发语言:C#
  • 实例大小:26.53M
  • 下载次数:230
  • 浏览次数:9042
  • 发布时间:2014-12-08
  • 实例类别:桌面应用界面/GUI
  • 发 布 人:1163463942
  • 文件格式:.zip
  • 所需积分:2
 相关标签: GridView 实例 DotNet

实例介绍

【实例简介】SuperGrid 实例
【实例截图】DotNetBar的GridView实例

【核心代码】

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Controls;
using DevComponents.DotNetBar.SuperGrid;
using DevComponents.DotNetBar.SuperGrid.Style;
 
namespace SuperGridDemo
{
    public partial class DemoGroupHeader : Office2007Form
    {
        #region Private variables
 
        private DataSet _DataSet;
        private Random _Rand = new Random();
 
        private int _BaseColumnCount;
        private int _HeaderCount;
        private int _StartColIndex;
        private int _EndColIndex;
 
        private GridColumn _HitColumn;
        private ColumnGroupHeader _HitGroupHeader;
        private List<ColumnGroupHeader> _SelectedGroupHeaders;
 
        private Point[] _ChartData1;
        private Point[] _ChartData2;
 
        #endregion
 
        public DemoGroupHeader()
        {
            InitializeComponent();
 
            // Initialize the grid, bind to our grid data
            // and set the sample description text
 
            InitializeGrid();
 
            ShellServices.LoadRtbText(richTextBox1,
                "SuperGridDemo.Resources.DemoGroupHeader.rtf");
        }
 
        #region InitializeGrid
 
        /// <summary>
        /// Initializes the default grid
        /// </summary>
        private void InitializeGrid()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
 
            panel.Name = "Customers";
            panel.MinRowHeight = 20;
 
            // Bind to our customer data and hook a few SuperGrid events.
 
            BindCustomerData();
 
            superGridControl1.ColumnHeaderClick  = ColumnHeaderClick;
            superGridControl1.ColumnGroupHeaderClick  = GroupHeaderClick;
 
            superGridControl1.PostRenderColumnGroupHeader  = SuperGridControl1PostRenderColumnGroupHeader;
            superGridControl1.ColumnGroupHeaderResized  = SuperGridControl1ColumnGroupHeaderResized;
 
            superGridControl1.ColumnGroupHeaderMarkupLinkClick  = SuperGridControl1ColumnGroupHeaderMarkupLinkClick;
            superGridControl1.ColumnHeaderMarkupLinkClick  = SuperGridControl1ColumnHeaderMarkupLinkClick;
 
            superGridControl1.DataBindingComplete  = SuperGridControl1DataBindingComplete;
        }
 
        #region BindCustomerData
 
        /// <summary>
        /// Creates and binds our data to the grid
        /// </summary>
        private void BindCustomerData()
        {
            string location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)   "\\Resources";
 
            if (location != null)
            {
                // Get and fill the Northwind db
 
                _DataSet = new DataSet();
 
                string path = Path.Combine(location, "nwind.mdb");
 
                using (OleDbConnection cn =
                    new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
                          path   ";User Id=admin;Password=;"))
                {
                    OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Customers;", cn);
                    adapter.Fill(_DataSet, "Customers");
                }
 
                // Add a few extraneous columns to our db, for
                // us to use as 'fill data' in various layouts.
  
                DataTable table = _DataSet.Tables["Customers"];
 
                _BaseColumnCount = table.Columns.Count;
 
                AddNewColumns(table, new string[] { "MTD", "YTD", "LTD" });
                AddNewColumns(table, new string[] { "P1", "P2", "P3", "P4" });
                AddNewColumns(table, new string[] { "T1", "T2", "T3" });
 
                // Fill the newly added columns with
                // 'useful' data.
 
                foreach (DataRow row in table.Rows)
                {
                    double d = _Rand.NextDouble() * 1000;
 
                    row["MTD"] = d;
                    row["YTD"] = d * 4;
                    row["LTD"] = d * 4 * _Rand.Next(10, 50);
 
                    row["P1"] = _Rand.NextDouble();
                    row["P2"] = _Rand.NextDouble();
                    row["P3"] = _Rand.NextDouble();
                    row["p4"] = _Rand.NextDouble();
 
                    row["T1"] = _Rand.NextDouble() * 10000;
                    row["T2"] = _Rand.NextDouble() * 20000;
                    row["T3"] = _Rand.NextDouble() * 30000;
                }
 
                // Bind our grid to the created dataset.
 
                superGridControl1.PrimaryGrid.DataSource = _DataSet;
                superGridControl1.PrimaryGrid.DataMember = "Customers";
            }
        }
 
        #region AddNewColumns
 
        /// <summary>
        /// Adds a set of new columns to the given table
        /// </summary>
        /// <param name="table"></param>
        /// <param name="names"></param>
        private void AddNewColumns(DataTable table, IEnumerable<string> names)
        {
            Type type = Type.GetType("System.Decimal");
 
            foreach (string name in names)
                table.Columns.Add(new DataColumn(name, type));
        }
 
        #endregion
 
        #endregion
 
        #endregion
 
        #region SuperGridControl1DataBindingComplete
 
        /// <summary>
        /// This routine is called after the data bind operation has
        /// been completed. This call-out lets you customize the display
        /// or visibility of the data however the application needs.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SuperGridControl1DataBindingComplete(
            object sender, GridDataBindingCompleteEventArgs e)
        {
            GridPanel panel = e.GridPanel;
            GridColumnCollection columns = panel.Columns;
 
            // Set a few default panel properties
 
            panel.DefaultRowHeight = 40;
            panel.UseAlternateRowStyle = true;
 
            // Set initial column defaults
 
            foreach (GridColumn col in columns)
            {
                col.CellStyles.Default.AllowWrap = Tbool.True;
 
                col.ColumnSortMode = ColumnSortMode.Multiple;
                col.EnableHeaderMarkup = true;
            }
 
            SetColumnTw(columns, "CustomerId", "ID", 50);
            SetColumnTw(columns, "CompanyName", "Company", 100);
            SetColumnTw(columns, "ContactName", "Name", 70);
            SetColumnTw(columns, "ContactTitle", "Title", 100);
            SetColumnTw(columns, "PostalCode", "Postal Code", 100);
            SetColumnTw(columns, "City", "City", 50);
            SetColumnTw(columns, "Country", "Country", 100);
            SetColumnTw(columns, "Region", "Region", 50);
 
            SetupCurrencyColumns(columns, new string[] {"MTD", "YTD", "LTD", "T1", "T2", "T3"});
            SetupPctColumns(columns, new string[] {"P1", "P2", "P3", "P4"});
 
            ResetLayout();
        }
 
        #region SetColumnTw
 
        /// <summary>
        /// Sets the header text and width for the given column.
        /// </summary>
        /// <param name="columns"></param>
        /// <param name="name"></param>
        /// <param name="text"></param>
        /// <param name="width"></param>
        private void SetColumnTw(GridColumnCollection columns,
            string name, string text, int width)
        {
            GridColumn col = columns[name];
 
            if (col != null)
            {
                col.HeaderText = text;
                col.Width = width;
            }
        }
 
        #endregion
 
        #region SetupCurrencyColumns
 
        /// <summary>
        /// Sets up the given columns to render/edit
        /// as a center-aligned Currency column.
        /// </summary>
        /// <param name="columns"></param>
        /// <param name="names"></param>
        private void SetupCurrencyColumns(GridColumnCollection columns, string[] names)
        {
            foreach (string name in names)
            {
                GridColumn column = columns[name];
 
                column.EditorType = typeof (MyCurrencyEditControl);
 
                column.CellStyles.Default.Alignment = Alignment.MiddleCenter;
            }
        }
 
        #region MyCurrencyEditControl
 
        /// <summary>
        /// Currency DoubleInput edit control
        /// </summary>
        public class MyCurrencyEditControl : GridDoubleInputEditControl
        {
            public MyCurrencyEditControl()
            {
                DisplayFormat = "C";
            }
        }
 
        #endregion
 
        #endregion
 
        #region SetupPctColumns
 
        /// <summary>
        /// Sets up the given column to render/edit
        /// as a center-aligned "percent" column.
        /// </summary>
        /// <param name="columns"></param>
        /// <param name="names"></param>
        private void SetupPctColumns(GridColumnCollection columns, string[] names)
        {
            foreach (string name in names)
            {
                GridColumn column = columns[name];
 
                column.EditorType = typeof(MyPercentEditControl);
 
                column.CellStyles.Default.Alignment = Alignment.MiddleCenter;
            }
        }
 
        #region MyPercentEditControl
 
        /// <summary>
        /// Percent DoubleInput edit control
        /// </summary>
        public class MyPercentEditControl : GridDoubleInputEditControl
        {
            public MyPercentEditControl()
            {
                DisplayFormat = "P";
            }
        }
 
        #endregion
 
        #endregion
 
        #endregion
 
        #region SetupLayout
 
        /// <summary>
        /// Performs setup needed when user
        /// selects a new grid layout.
        /// </summary>
        private void SetupLayout()
        {
            // Reset everything back to default in
            // preparation of moving everything around again.
 
            ResetLayout();
 
            // Initiate the setup of the chosen layout.
 
            if (cbInternal.Checked == true)
                SetupInternalLayout();
 
            else if (cbSales.Checked == true)
                SetupSalesLayout();
 
            else if (cbMarketing.Checked == true)
                SetupMarketingLayout();
 
            else if (cbAdvertising.Checked == true)
                SetupAdvertisingLayout();
 
            else if (cbCorporate.Checked == true)
                SetupCorporateLayout();
        }
 
        #region SetupInternalLayout
 
        /// <summary>
        /// Sets up the 'Internal' layout.
        /// </summary>
        private void SetupInternalLayout()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
            GridColumnCollection columns = panel.Columns;
 
            // Move the 'Country' column to position 7
 
            columns["Country"].DisplayIndex = 7;
 
            // Create the 'AdditionalInfo' header and add
            // it to the panel's root GroupHeader collection.
 
            ColumnGroupHeader cgh = GetIlAdditionalInfoHeader(columns);
 
            panel.ColumnHeader.GroupHeaders.Add(cgh);
        }
 
        #region GetIlAdditionalInfoHeader
 
        /// <summary>
        /// Creates the 'AdditionalInfo" GroupHeader
        /// </summary>
        /// <param name="columns"></param>
        /// <returns>Created header</returns>
        private ColumnGroupHeader GetIlAdditionalInfoHeader(GridColumnCollection columns)
        {
            // Create the 'AddInfo' GroupHeader
 
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "AddInfo";
            cgh.HeaderText = "Additional Information";
 
            cgh.MinRowHeight = 36;
 
            // Get the subordinate 'Contact' and 'RegInfo'
            // GroupHeaders and add them to our header.
 
            ColumnGroupHeader cshContact = GetAdContactHeader(columns);
            ColumnGroupHeader cshRegInfo = GetAdRegInfoHeader(columns);
 
            cgh.GroupHeaders.Add(cshContact);
            cgh.GroupHeaders.Add(cshRegInfo);
 
            return (cgh);
        }
 
        #region GetAdContactHeader
 
        /// <summary>
        /// Gets the 'Contact' group header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetAdContactHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.MinRowHeight = 36;
 
            cgh.Name = "ContactInfo";
            cgh.HeaderText = "Contact";
 
            // Set the start and end Display Index which the
            // group header is associated with.
 
            cgh.StartDisplayIndex = columns.GetDisplayIndex(columns["ContactName"]);
            cgh.EndDisplayIndex = columns.GetDisplayIndex(columns["ContactTitle"]);
 
            return (cgh);
        }
 
        #endregion
 
        #region GetAdRegInfoHeader
 
        /// <summary>
        /// Gets the 'Regional" group header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetAdRegInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "RegInfo";
            cgh.HeaderText = "Regional Information";
 
            cgh.MinRowHeight = 36;
 
            // Get the subordinate 'AdrInfo' and 'CommInfo'
            // GroupHeaders and add them to our header.
 
            ColumnGroupHeader cshAddr = GetRiAddrHeader(columns);
            ColumnGroupHeader cshComm = GetRiCommHeader(columns);
 
            cgh.GroupHeaders.Add(cshAddr);
            cgh.GroupHeaders.Add(cshComm);
 
            return (cgh);
        }
 
        #region GetRiAddrHeader
 
        /// <summary>
        /// Gets the 'Address" info group header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetRiAddrHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "AddrInfo";
            cgh.HeaderText = "Address Information";
 
            cgh.MinRowHeight = 36;
 
            // Set the start and end Display Index that the
            // group header is associated with.
 
            cgh.StartDisplayIndex = columns.GetDisplayIndex(columns["Address"]);
            cgh.EndDisplayIndex = columns.GetDisplayIndex(columns["PostalCode"]);
 
            return (cgh);
        }
 
        #endregion
 
        #region GetRiCommHeader
 
        private ColumnGroupHeader GetRiCommHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "CommInfo";
            cgh.HeaderText = "Communication";
 
            cgh.MinRowHeight = 36;
 
            cgh.StartDisplayIndex = columns.GetDisplayIndex(columns["Phone"]);
            cgh.EndDisplayIndex = columns.GetDisplayIndex(columns["Fax"]);
 
            return (cgh);
        }
 
        #endregion
 
        #endregion
 
        #endregion
 
        #endregion
 
        #region SetupSalesLayout
 
        /// <summary>
        /// Sets up the 'Sales' layout
        /// </summary>
        private void SetupSalesLayout()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
            GridColumnCollection columns = panel.Columns;
 
            // Hide a few columns, and move a few around
            // to achieve the ordering we need for this layout.
 
            HideColumn(columns, "Address");
            HideColumn(columns, "PostalCode");
 
            columns["City"].DisplayIndex = 2;
            columns["Country"].DisplayIndex = 3;
            columns["Region"].DisplayIndex = 4;
            columns["ContactName"].DisplayIndex = 5;
            columns["ContactTitle"].DisplayIndex = 6;
            columns["Phone"].DisplayIndex = 7;
            columns["Fax"].DisplayIndex = 8;
 
            ShowColumn(columns, "MTD", 9, "Quarterly");
            ShowColumn(columns, "YTD", 10, "Yearly");
            ShowColumn(columns, "LTD", 11, "Lifetime");
 
            // Add our headers to the root GroupHeader
 
            panel.ColumnHeader.GroupHeaders.Add(GetSlCompanyInfoHeader(columns));
            panel.ColumnHeader.GroupHeaders.Add(GetSlRegionalInfoHeader(columns));
            panel.ColumnHeader.GroupHeaders.Add(GetSlContactInfoHeader(columns));
            panel.ColumnHeader.GroupHeaders.Add(GetSlSalesInfoHeader(columns));
        }
 
        #region GetSlCompanyInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Company Info' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetSlCompanyInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "Company";
 
            // Set the header to not show the root column headers, and
            // perform some misc Style/display related setup.
 
            cgh.ShowColumnHeaders = Tbool.False;
            cgh.MinRowHeight = 36;
 
            cgh.HeaderStyles.Default.Image = imageList1.Images["Cog"];
            cgh.HeaderStyles.Default.ImageAlignment = Alignment.MiddleCenter;
            cgh.HeaderStyles.Default.Background = new Background(Color.LightBlue, Color.CadetBlue);
            cgh.HeaderStyles.MouseOver.Background = new Background(Color.CadetBlue, Color.LightBlue);
 
            // Set the header's start and end Display Indecees
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "CustomerId");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "CompanyName");
 
            return (cgh);
        }
 
        #endregion
 
        #region GetSlRegionalInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Regional Info' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetSlRegionalInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "RegionalInfo";
            cgh.HeaderText = "Regional Information";
 
            // Set the header to not show the root column headers, and
            // perform some misc Style/display related setup.
 
            cgh.ShowColumnHeaders = Tbool.False;
            cgh.MinRowHeight = 36;
 
            cgh.HeaderStyles.Default.Image = imageList2.Images["Region"];
            cgh.HeaderStyles.Default.ImageAlignment = Alignment.MiddleRight;
            cgh.HeaderStyles.Default.ImageOverlay = ImageOverlay.Bottom;
            cgh.HeaderStyles.Default.ImagePadding = new DevComponents.DotNetBar.SuperGrid.Style.Padding(6);
 
            // Set the header's start and end Display Indexes
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "City");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "Region");
 
            return (cgh);
        }
 
        #endregion
 
        #region GetSlContactInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Contact Info' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetSlContactInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "ContactInfo";
            cgh.HeaderText = "Contact Information";
 
            cgh.MinRowHeight = 36;
 
            cgh.HeaderStyles.Default.Image = imageList2.Images["Contact"];
            cgh.HeaderStyles.Default.ImageAlignment = Alignment.MiddleRight;
            cgh.HeaderStyles.Default.ImageOverlay = ImageOverlay.Bottom;
            cgh.HeaderStyles.Default.ImagePadding = new DevComponents.DotNetBar.SuperGrid.Style.Padding(6);
 
            cgh.HeaderStyles.Default.Background = new Background(Color.LightYellow, Color.Khaki);
            cgh.HeaderStyles.MouseOver.Background = new Background(Color.Khaki, Color.LightYellow);
 
            // Set the header's start and end Display Indecees
             
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "ContactName");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "Fax");
 
            return (cgh);
        }
 
        #endregion
 
        #region GetSlSalesInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Sales Info' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetSlSalesInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "SalesInfo";
            cgh.HeaderText = "Sales Figures";
 
            cgh.MinRowHeight = 36;
 
            cgh.HeaderStyles.Default.Image = imageList2.Images["Sales"];
            cgh.HeaderStyles.Default.ImageAlignment = Alignment.MiddleRight;
            cgh.HeaderStyles.Default.ImageOverlay = ImageOverlay.Bottom;
            cgh.HeaderStyles.Default.ImagePadding = new DevComponents.DotNetBar.SuperGrid.Style.Padding(6);
 
            // Set the header's start and end Display Indecees
             
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "MTD");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "LTD");
 
            return (cgh);
        }
 
        #endregion
 
        #endregion
 
        #region SetupMarketingLayout
 
        /// <summary>
        /// Sets up the 'Marketing' Layout
        /// </summary>
        private void SetupMarketingLayout()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
            GridColumnCollection columns = panel.Columns;
 
            const string revShare = "<div align=\"center\">" 
                    "<font color=\"Green\">Revenue</font><br/>" 
                    "<font color=\"DarkRed\">Share</font></div>";
 
            const string unitShare = "<div align=\"center\">" 
                    "<font color=\"blue\">Unit</font><br/>" 
                    "<font color=\"DarkRed\">Share</font></div>";
 
            // Hide, show, and rearrange the columns for this layout
 
            HideColumn(columns, "CompanyName");
            HideColumn(columns, "ContactName");
            HideColumn(columns, "ContactTitle");
            HideColumn(columns, "Address");
            HideColumn(columns, "Phone");
            HideColumn(columns, "Region");
            HideColumn(columns, "Fax");
 
            ShowColumn(columns, "CustomerID", 0, null);
            ShowColumn(columns, "City", 1, null);
            ShowColumn(columns, "PostalCode", 2, null);
            ShowColumn(columns, "Country", 3, null);
            ShowColumn(columns, "P1", 4, unitShare);
            ShowColumn(columns, "P2", 5, revShare);
            ShowColumn(columns, "P3", 6, "Pyramid");
            ShowColumn(columns, "P4", 7, "Momentum");
 
            columns["CustomerID"].HeaderStyles.MouseOver.Background = new Background(Color.Yellow);
 
            // Add the Market group header to the root
            // GroupHeader collection.
 
            panel.ColumnHeader.GroupHeaders.Add(GetMlMarketHeader(columns));
        }
 
        #region GetMlMarketHeader
 
        /// <summary>
        /// Creates and returns the 'Market' group header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetMlMarketHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "Market";
            cgh.MinRowHeight = 46;
 
            // Enable MiniMarkup and set the header text as needed
 
            cgh.EnableHeaderMarkup = true;
 
            cgh.HeaderText = "<div align=\"center\"><font size=\"14\">Market Data</font> "  
                "<font size=\"7\" color=\"darkred\">(Intl and Domestic)</font></div>";
 
            cgh.HeaderStyles.MouseOver.Background = new Background(Color.Yellow);
 
            // Create and add the subordinate group headers
 
            ColumnGroupHeader cshArea = GetMlMarketAreaHeader(columns);
            ColumnGroupHeader cshPop = GetMlMarketPopHeader(columns);
 
            cgh.GroupHeaders.Add(cshArea);
            cgh.GroupHeaders.Add(cshPop);
 
            // We want the header to also contain the 'City' column
            // so we must include it in the display range.
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "City");
 
            return (cgh);
        }
 
        #endregion
 
        #region GetMlMarketAreaHeader
 
        /// <summary>
        /// Creates and returns the 'Market Area' group header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetMlMarketAreaHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "MarketArea";
            cgh.HeaderText = "Market Area";
 
            cgh.HeaderStyles.Default.Background = new Background(Color.Goldenrod, Color.Yellow, BackFillType.HorizontalCenter);
            cgh.HeaderStyles.MouseOver.Background = new Background(Color.Yellow);
 
            cgh.MinRowHeight = 36;
 
            // Set the group's start and end display indicees
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "PostalCode");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "Country");
 
            return (cgh);
        }
 
        #endregion
 
        #region GetMlMarketPopHeader
 
        /// <summary>
        /// Creates and returns the 'Market Population' group header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetMlMarketPopHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "MarketPop";
            cgh.HeaderText = "Market Population";
 
            cgh.HeaderStyles.Default.Background = new Background(Color.ForestGreen, Color.GreenYellow, BackFillType.HorizontalCenter);
            cgh.HeaderStyles.MouseOver.Background = new Background(Color.Yellow);
 
            cgh.MinRowHeight = 36;
 
            // Set the group's start and end display indicees.
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "P3");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "P4");
 
            return (cgh);
        }
 
        #endregion
 
        #endregion
 
        #region SetupAdvertisingLayout
 
        /// <summary>
        /// Sets up the 'Advertising Info' header
        /// </summary>
        private void SetupAdvertisingLayout()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
            GridColumnCollection columns = panel.Columns;
 
            // Hide, show, and rearrange a few columns to
            // achieve the layout we want.
 
            HideColumn(columns, "CustomerID");
            HideColumn(columns, "CompanyName");
            HideColumn(columns, "ContactName");
            HideColumn(columns, "ContactTitle");
            HideColumn(columns, "Address");
            HideColumn(columns, "City");
            HideColumn(columns, "Phone");
            HideColumn(columns, "Fax");
 
            ShowColumn(columns, "PostalCode", 0, null);
            ShowColumn(columns, "Region", 1, null);
            ShowColumn(columns, "Country", 2, null);
            ShowColumn(columns, "T1", 3, "Past");
            ShowColumn(columns, "T2", 4, "Potential");
            ShowColumn(columns, "MTD", 5, null);
            ShowColumn(columns, "YTD", 6, null);
            ShowColumn(columns, "LTD", 7, "Lifetime");
 
            // Have the 'Country' column base header to be hidden, and
            // set its HeaderText to contain a MiniMarkup link (when the
            // link is clicked we will count how many unique countries
            // there are in the grid column).
 
            GridColumn col = columns["Country"];
 
            col.EnableHeaderMarkup = true;
 
            col.HeaderText = "<div align=\"center\">Country<br/>" 
                "<font size=\"7\"><a href=\"MoreInfo\">(Count)</a></font></div>";
 
            // Create and add the sub-headers to the group.
 
            panel.ColumnHeader.GroupHeaders.Add(GetAlPostalInfoHeader(columns));
            panel.ColumnHeader.GroupHeaders.Add(GetAlAdvertisingInfoHeader(columns));
        }
 
        #region GetAlPostalInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Postal Info' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetAlPostalInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "PostalInfo";
            cgh.HeaderText = "Postal Information";
 
            cgh.MinRowHeight = 36;
 
            // Create the 'LocaleInfo' header and add
            // it to the postal group header.
 
            ColumnGroupHeader cshLocaleInfo = GetAlLocaleInfoHeader(columns);
 
            cgh.GroupHeaders.Add(cshLocaleInfo);
 
            // Here we want to extend the range of the postal header
            // to also include the 'Country' column, so we must
            // set the EndDisplayIndex to reflect that.
 
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "Country");
 
            return (cgh);
        }
 
        #region GetAlLocaleInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Locale Info' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetAlLocaleInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "LocaleInfo";
            cgh.HeaderText = "Locale";
 
            cgh.MinRowHeight = 36;
 
            // Set the groups start and end display index
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "PostalCode");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "Region");
 
            return (cgh);
        }
 
        #endregion
 
        #endregion
 
        #region GetAlAdvertisingInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Advertising Info' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetAlAdvertisingInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "AdInfo";
            cgh.MinRowHeight = 36;
 
            // Enable MiniMarkup for the header, and set the Header Text
            // to present a Markup link for the user to click for more info.
 
            cgh.EnableHeaderMarkup = true;
 
            cgh.HeaderText = "<div align=\"center\">Advertising Breakdown<br/>" 
                "<font size=\"7\"><a href=\"MoreInfo\">(More Info)</a></font></div>";
 
            cgh.HeaderStyles.Default.Padding = new DevComponents.DotNetBar.SuperGrid.Style.Padding(4);
 
            // Create the subordinate headers and add them to the group
 
            ColumnGroupHeader cshAcquisition = GetAdRevenueHeader(columns);
            ColumnGroupHeader cshReturn = GetAdReturnHeader(columns);
 
            cgh.GroupHeaders.Add(cshAcquisition);
            cgh.GroupHeaders.Add(cshReturn);
 
            return (cgh);
        }
 
        #region GetAdRevenueHeader
 
        /// <summary>
        /// Creates and returns the 'Revenue' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetAdRevenueHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "Revenue";
            cgh.MinRowHeight = 36;
 
            // Set the group's start and end display indicees
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "T1");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "T2");
 
            return (cgh);
        }
 
        #endregion
 
        #region GetAdReturnHeader
 
        /// <summary>
        /// Creates and returns the 'Return Info' header
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetAdReturnHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "ReturnInfo";
            cgh.HeaderText = "Return on Investment";
 
            cgh.MinRowHeight = 36;
 
            // Set the group's start and end display indicees
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "MTD");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "LTD");
 
            return (cgh);
        }
 
        #endregion
 
        #endregion
 
        #endregion
 
        #region SetupCorporateLayout
 
        /// <summary>
        /// Sets up the 'Corporate' layout
        /// </summary>
        private void SetupCorporateLayout()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
            GridColumnCollection columns = panel.Columns;
             
            // Hide and show various columns to achieve
            // the layout we need for this header grouping.
 
            HideColumn(columns, "ContactName");
            HideColumn(columns, "ContactTitle");
            HideColumn(columns, "Address");
            HideColumn(columns, "City");
            HideColumn(columns, "PostalCode");
            HideColumn(columns, "Phone");
            HideColumn(columns, "Region");
            HideColumn(columns, "Fax");
 
            ShowColumn(columns, "T1", 90, "Total\nInv. Cost");
            ShowColumn(columns, "MTD", 91, null);
            ShowColumn(columns, "YTD", 92, null);
            ShowColumn(columns, "LTD", 93, "Lifetime");
            ShowColumn(columns, "T2", 94, "Market\nPotential");
            ShowColumn(columns, "T3", 95, "Market\nMomentum");
 
            columns["CompanyName"].HeaderStyles.Default.Image = imageList3.Images["factory"];
            columns["CompanyName"].HeaderStyles.Default.ImageAlignment = Alignment.BottomCenter;
            columns["CompanyName"].HeaderStyles.Default.ImagePadding = new DevComponents.DotNetBar.SuperGrid.Style.Padding(0, 0, 0, 15);
 
            // Create and add the subordinate headers
 
            panel.ColumnHeader.GroupHeaders.Add(GetClCurrentInfoHeader(columns));
            panel.ColumnHeader.GroupHeaders.Add(GetClProjectedInfoHeader(columns));
        }
 
        #region GetClCurrentInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Current Info' header.
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetClCurrentInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "CurrentState";
            cgh.HeaderText = "Current Balance";
 
            cgh.MinRowHeight = 36;
 
            // Create the 'Sales' header and add it to the group
 
            ColumnGroupHeader cshSales = GetCiSalesHeader(columns);
 
            cgh.GroupHeaders.Add(cshSales);
 
            // We want to also include the "T1" column to the left
            // of the added sales range, so we must set the start
            // display index to include it.
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "T1");
 
            return (cgh);
        }
 
        #region GetCiSalesHeader
 
        /// <summary>
        /// Creates and returns the 'Sales Info' header.
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetCiSalesHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "SalesInfo";
            cgh.HeaderText = "Sales";
 
            cgh.MinRowHeight = 36;
 
            // Set the group's start and end display indicees
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "MTD");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "LTD");
 
            return (cgh);
        }
 
        #endregion
 
        #endregion
 
        #region GetClProjectedInfoHeader
 
        /// <summary>
        /// Creates and returns the 'Projected Info' header.
        /// </summary>
        /// <param name="columns"></param>
        /// <returns></returns>
        private ColumnGroupHeader GetClProjectedInfoHeader(GridColumnCollection columns)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "ProjectedInfo";
            cgh.HeaderText = "Market Projection";
 
            cgh.MinRowHeight = 36;
 
            // Set the group's start and end indicees
 
            cgh.StartDisplayIndex = GetDisplayIndex(columns, "T2");
            cgh.EndDisplayIndex = GetDisplayIndex(columns, "T3");
 
            return (cgh);
        }
 
        #endregion
 
        #endregion
 
        #region GetDisplayIndex
 
        /// <summary>
        /// Gets the DisplayIndex for the column with the given name.
        /// </summary>
        /// <param name="columns"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        private int GetDisplayIndex(GridColumnCollection columns, string name)
        {
            return (columns.GetDisplayIndex(columns[name]));
        }
 
        #endregion
 
        #region RemoveColumn
 
        /// <summary>
        /// Hides the column with the given name.
        /// </summary>
        /// <param name="columns"></param>
        /// <param name="name"></param>
        private void HideColumn(GridColumnCollection columns, string name)
        {
             columns[name].Visible = false;
        }
 
        #endregion
 
        #region ShowColumn
 
        /// <summary>
        /// Shows, orders, and set the header text of the
        /// column with the given name.
        /// </summary>
        /// <param name="columns"></param>
        /// <param name="name"></param>
        /// <param name="dindex"></param>
        /// <param name="headerText"></param>
        private void ShowColumn(
            GridColumnCollection columns, string name, int dindex, string headerText)
        {
            GridColumn col = columns[name];
 
            col.Visible = true;
            col.DisplayIndex = dindex;
 
            if (headerText != null)
                col.HeaderText = headerText;
        }
 
        #endregion
 
        #endregion
 
        #region ResetLayout
 
        /// <summary>
        /// Reset the grid layout back to its default.
        /// </summary>
        private void ResetLayout()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
            GridColumnCollection columns = panel.Columns;
 
            for (int i = 0; i < columns.Count; i  )
            {
                GridColumn col = columns[i];
 
                col.Visible = (i < _BaseColumnCount);
                col.DisplayIndex = -1;
 
                col.HeaderStyles.Default.Image = null;
                col.HeaderStyles.Default.Background = null;
                col.HeaderStyles.MouseOver.Background = null;
                col.CellStyles.Default.Background = null;
            }
 
            columns["Country"].HeaderText = null;
 
            panel.ColumnHeader.GroupHeaders.Clear();
            panel.ClearAll();
        }
 
        #endregion
 
        #region SuperGridControl1ColumnHeaderMarkupLinkClick
 
        /// <summary>
        /// Handles ColumnHeader MarkupLink clicks,
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SuperGridControl1ColumnHeaderMarkupLinkClick(
            object sender, GridColumnHeaderMarkupLinkClickEventArgs e)
        {
            // Do a simple-minded summation of the unique
            // country names present in the grid.
 
            int colIndex = e.GridColumn.ColumnIndex;
 
            Dictionary<string, string> dict = new Dictionary<string, string>();
 
            foreach (GridRow row in e.GridPanel.FlatRows)
            {
                string s = row.GetCell(colIndex).Value.ToString();
 
                if (dict.ContainsKey(s) == false)
                    dict.Add(s, s);
            }
 
            MessageBoxEx.Show("There are "   dict.Count   " unique countries.");
        }
 
        #endregion
 
        #region SuperGridControl1ColumnGroupHeaderMarkupLinkClick
 
        /// <summary>
        /// Handles GroupHeader MarkupLink clicks.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SuperGridControl1ColumnGroupHeaderMarkupLinkClick(
            object sender, GridColumnGroupHeaderMarkupLinkClickEventArgs e)
        {
            if (e.GroupHeader.Name.Equals("AdInfo") == true)
                MessageBoxEx.Show("For More Information, please contact:\n\nDave Stanton at x3227");
        }
 
        #endregion
 
        #region SuperGridControl1ColumnGroupHeaderResized
 
        /// <summary>
        /// Handles Colum GroupHeader size change notifications
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SuperGridControl1ColumnGroupHeaderResized(object sender, GridColumnGroupHeaderResizedEventArgs e)
        {
            // If the "ProjectedInfo" size has changed, then clear out our chart
            // data so that we can recalc new data based upon the new header size.
 
            if (e.GroupHeader.Name.Equals("ProjectedInfo") == true)
                _ChartData1 = _ChartData2 = null;
        }
 
        #endregion
 
        #region SuperGridControl1PostRenderColumnGroupHeader
 
        /// <summary>
        /// Handles Post rendering of Column GroupHeaders
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SuperGridControl1PostRenderColumnGroupHeader(
            object sender, GridPostRenderColumnGroupHeaderEventArgs e)
        {
            // If the grid is rendering the background of the 'ProjectedInfo'
            // GroupHeader, then draw a couple simple 'line charts'.
 
            if ((e.RenderParts & RenderParts.Background) == RenderParts.Background)
            {
                ColumnGroupHeader cgh = e.GroupHeader;
 
                if (cgh.Name.Equals("ProjectedInfo") == true)
                {
                    Rectangle r = e.Bounds;
                    r.Inflate(-8, -8);
 
                    if (_ChartData1 == null)
                        _ChartData1 = GetChartData(r, 15);
 
                    if (_ChartData2 == null)
                        _ChartData2 = GetChartData(r, 10);
 
                    SmoothingMode sm = e.Graphics.SmoothingMode;
                    e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
 
                    if (_ChartData1 != null)
                        e.Graphics.DrawLines(Pens.LightGreen, GetChartPoints(r, _ChartData1));
 
                    if (_ChartData2 != null)
                        e.Graphics.DrawLines(Pens.LightSalmon, GetChartPoints(r, _ChartData2));
 
                    e.Graphics.SmoothingMode = sm;
                }
            }
        }
 
        #region GetChartData
 
        /// <summary>
        /// Gets chart data, given the current GroupHeader bounds
        /// </summary>
        /// <param name="r"></param>
        /// <param name="dx"></param>
        /// <returns></returns>
        private Point[] GetChartData(Rectangle r, int dx)
        {
            int xc = r.Width / dx;
 
            Point[] pts = new Point[xc   1];
 
            Random rand = new Random();
 
            for (int i = 0; i <= xc; i  )
                pts[i] = new Point(i * dx, -rand.Next(0, r.Height));
 
            return (pts);
        }
 
        #endregion
 
        #region GetChartPoints
 
        /// <summary>
        /// Gets chart points given the current position of the GroupHeader.
        /// </summary>
        /// <param name="r"></param>
        /// <param name="pts1"></param>
        /// <returns></returns>
        private Point[] GetChartPoints(Rectangle r, Point[] pts1)
        {
            Point[] pts2 = new Point[pts1.Length];
 
            for (int i = 0; i < pts2.Length; i  )
            {
                pts2[i].X = pts1[i].X   r.X;
                pts2[i].Y = pts1[i].Y   r.Bottom;
            }
 
            return (pts2);
        }
 
        #endregion
 
        #endregion
 
        #region ColumnHeaderClick
 
        /// <summary>
        /// Handles Column Header clicks.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ColumnHeaderClick(object sender, GridColumnHeaderClickEventArgs e)
        {
            // If it is a right-mouse click, save of some selection
            // info for later use (context menu selection).
 
            if (e.MouseEventArgs.Button == MouseButtons.Right)
            {
                _HitColumn = e.GridColumn;
 
                GetSelectedColumnRange();
 
                ShowContextMenu(InColumnHeader);
            }
        }
 
        #region GetSelectedColumnRange
 
        /// <summary>
        /// Gets the current range of selected columns.
        /// </summary>
        private void GetSelectedColumnRange()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
            GridColumnCollection columns = panel.Columns;
 
            if (_HitColumn.IsSelected == true)
            {
                int hitIndex = columns.GetDisplayIndex(_HitColumn);
                ColumnGroupHeader hitParent = panel.ColumnHeader.GetParentHeader(hitIndex);
 
                _StartColIndex = GetStartDisplayIndex(panel, hitIndex, hitParent);
                _EndColIndex = GetEndDisplayIndex(panel, hitIndex, hitParent);
            }
            else
            {
                _StartColIndex = columns.GetDisplayIndex(_HitColumn);
                _EndColIndex = _StartColIndex;
            }
        }
 
        #region GetStartDisplayIndex
 
        /// <summary>
        /// Gets the starting display index, relative to the
        /// given item.
        /// </summary>
        /// <param name="panel"></param>
        /// <param name="hitIndex"></param>
        /// <param name="hitParent"></param>
        /// <returns></returns>
        private int GetStartDisplayIndex(
            GridPanel panel, int hitIndex, ColumnGroupHeader hitParent)
        {
            // Walk backward through all siblings of the given item.
 
            int index = hitIndex;
 
            for (int i = hitIndex; i >= 0; i--)
            {
                if (IsChildColumn(panel, hitParent, i) == false)
                    break;
 
                index = i;
            }
 
            return (index);
        }
 
        #endregion
 
        #region GetEndDisplayIndex
 
        /// <summary>
        /// Gets the ending display index relative to the
        /// given item.
        /// </summary>
        /// <param name="panel"></param>
        /// <param name="hitIndex"></param>
        /// <param name="hitParent"></param>
        /// <returns></returns>
        private int GetEndDisplayIndex(
            GridPanel panel, int hitIndex, ColumnGroupHeader hitParent)
        {
            // Walk forward through each of the item's siblings.
 
            int index = hitIndex;
 
            for (int i = hitIndex; i < panel.Columns.Count; i  )
            {
                if (IsChildColumn(panel, hitParent, i) == false)
                    break;
 
                index = i;
            }
 
            return (index);
        }
 
        #endregion
 
        #region IsChildColumn
 
        /// <summary>
        /// Determines if the given column is a child of the given parent item.
        /// </summary>
        /// <param name="panel"></param>
        /// <param name="hitParent"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        private bool IsChildColumn(GridPanel panel, ColumnGroupHeader hitParent, int index)
        {
            GridColumn column = panel.Columns.ColumnAtDisplayIndex(index);
 
            if (column.Visible == true)
            {
                if (column.IsSelected == false)
                    return (false);
 
                ColumnGroupHeader parent = panel.ColumnHeader.GetParentHeader(index);
 
                if (parent != hitParent)
                    return (false);
            }
 
            return (true);
        }
 
        #endregion
 
        #endregion
 
        #endregion
 
        #region GroupHeaderClick
 
        /// <summary>
        /// Handles Group Header clicks.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void GroupHeaderClick(object sender, GridColumnGroupHeaderClickEventArgs e)
        {
            if (e.MouseEventArgs.Button == MouseButtons.Right)
            {
                // Right-mouse button clicks will
                // result in context menu being displayed.
 
                _HitGroupHeader = e.GroupHeader;
 
                _SelectedGroupHeaders = GetSelectedHeaders(e);
 
                if (_SelectedGroupHeaders.Count > 1)
                    ShowContextMenu(InMultipleHeader);
                else
                    ShowContextMenu(InSingleHeader);
            }
            else if (e.MouseEventArgs.Button == MouseButtons.Left)
            {
                // Clicking in the PostalInfo header will cause a
                // 'cycling' sort on the PostalCode and Country columns.
 
                if (e.GroupHeader.Name.Equals("PostalInfo"))
                {
                    if (e.GridPanel.ColumnGroupHeaderClickBehavior == ColumnHeaderClickBehavior.SortAndReorder)
                    {
                        GridColumn[] sortCols = new GridColumn[]
                            {e.GridPanel.Columns["PostalCode"], e.GridPanel.Columns["Country"]};
 
                        if (e.GridPanel.SortColumns.Count == 2)
                            e.GridPanel.SetSort(sortCols, GetSortDir(sortCols));
                        else
                            e.GridPanel.SetSort(sortCols);
 
                        e.Cancel = true;
                    }
                }
            }
        }
 
        #region GetSortDir
 
        /// <summary>
        /// Gets the cyclic sort direction for the Postal columns.
        /// </summary>
        /// <param name="cols"></param>
        /// <returns></returns>
        private SortDirection[] GetSortDir(GridColumn[] cols)
        {
            int d1 = (int)(cols[0].SortDirection);
            int d2 = (int)(cols[1].SortDirection);
 
            if (  d2 > 2)
            {
                d2 = 1;
 
                if (  d1 > 2)
                    d1 = 1;
            }
 
            return (new SortDirection[] { (SortDirection)d1, (SortDirection)d2 });
        }
 
        #endregion
 
        #region GetSelectedHeaders
 
        /// <summary>
        /// Retrieves a list of selected GroupHeaders
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private List<ColumnGroupHeader> GetSelectedHeaders(GridColumnGroupHeaderClickEventArgs e)
        {
            List<ColumnGroupHeader> list = new List<ColumnGroupHeader>();
 
            if (_HitGroupHeader.IsSelected == true)
            {
                // If the header is currently selected, then loop through
                // each of the supordinate headers and add them to the list.
 
                ColumnGroupHeaderCollection collection = e.GroupHeader.Collection;
 
                foreach (ColumnGroupHeader cgh in collection)
                {
                    if (cgh.IsSelected == true)
                        list.Add(cgh);
                }
            }
            else
            {
                // Not selected, add the single header to the list.
 
                list.Add(_HitGroupHeader);
            }
 
            return (list);
        }
 
        #endregion
 
        #endregion
 
        #region ShowContextMenu
 
        /// <summary>
        /// Shows the given context menu at the
        /// current mouse position.
        /// </summary>
        /// <param name="cm"></param>
        private void ShowContextMenu(ButtonItem cm)
        {
            cm.Popup(MousePosition);
        }
 
        #endregion
 
        #region ColumnHeader ClickBehavior change
 
        /// <summary>
        /// Handles ColumnHeader ClickBehavior.None events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbChNoActionCheckedChanged(object sender, EventArgs e)
        {
            SetColHeaderAction(ColumnHeaderClickBehavior.None);
        }
 
        /// <summary>
        /// Handles ColumnHeader ClickBehavior.Select events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbChSelectCheckedChanged(object sender, EventArgs e)
        {
            SetColHeaderAction(ColumnHeaderClickBehavior.Select);
        }
 
        /// <summary>
        /// Handles ColumnHeader ClickBehavior.SortAndReorder events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbChReorderCheckedChanged(object sender, EventArgs e)
        {
            SetColHeaderAction(ColumnHeaderClickBehavior.SortAndReorder);
        }
 
        /// <summary>
        /// Sets the ColumnHeader click behavior and then
        /// returns focus to the SuperGrid.
        /// </summary>
        /// <param name="cmode"></param>
        private void SetColHeaderAction(ColumnHeaderClickBehavior cmode)
        {
            superGridControl1.PrimaryGrid.ColumnHeaderClickBehavior = cmode;
 
            superGridControl1.Focus();
        }
 
        #endregion
 
        #region GroupHeader ClickBehavior change
 
        /// <summary>
        /// Handles GroupHeader ClickBehavior.None events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbShNoActionCheckedChanged(object sender, EventArgs e)
        {
            SetGroupHeaderAction(ColumnHeaderClickBehavior.None);
        }
 
        /// <summary>
        /// Handles GroupHeader ClickBehavior.Select events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbShSelectCheckedChanged(object sender, EventArgs e)
        {
            SetGroupHeaderAction(ColumnHeaderClickBehavior.Select);
        }
 
        /// <summary>
        /// Handles GroupHeader ClickBehavior.SortAndReorder events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbShReorderCheckedChanged(object sender, EventArgs e)
        {
            SetGroupHeaderAction(ColumnHeaderClickBehavior.SortAndReorder);
        }
 
        /// <summary>
        /// Sets the GroupHeader click behavior and then
        /// returns focus to the SuperGrid.
        /// </summary>
        /// <param name="cmode"></param>
        private void SetGroupHeaderAction(ColumnHeaderClickBehavior cmode)
        {
            superGridControl1.PrimaryGrid.ColumnGroupHeaderClickBehavior = cmode;
 
            superGridControl1.Focus();
        }
 
        #endregion
 
        #region CbLayoutCheckedChanged
 
        /// <summary>
        /// Handle user Layout change requests
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbLayoutCheckedChanged(object sender, EventArgs e)
        {
            CheckBoxX cb = sender as CheckBoxX;
 
            if (cb != null && cb.Checked == true)
                SetupLayout();
 
            superGridControl1.Focus();
        }
 
        #endregion
 
        #region CmiAddHeader
 
        /// <summary>
        /// Handles user requests to add a group header.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CmiAddHeader(object sender, EventArgs e)
        {
            List<ColumnGroupHeader> list = _SelectedGroupHeaders;
 
            if (list.Count > 0)
            {
                SelectedRange range = GetColumnRange(list);
 
                if (range != null)
                {
                    // The user has selected a range of headers to
                    // to include in a new GroupHeader, so get a new header
                    // and set it's start and end display indicees accordingly.
 
                    ColumnGroupHeader cgh = GetNewHeader(range.StartIndex, range.EndIndex);
 
                    // To add the range of headers to the new header, we must remove them
                    // from their current collection, and add them to the new header
                    // collection.
 
                    ColumnGroupHeaderCollection pcsc = list[0].Collection;
 
                    for (int i = list.Count - 1; i >= 0; i--)
                    {
                        pcsc.Remove(list[i]);
 
                        cgh.GroupHeaders.Add(list[i]);
                    }
 
                    // Now add the new header to the parent collection.
 
                    pcsc.Add(cgh);
                }
            }
        }
 
        #region GetColumnRange
 
        /// <summary>
        /// Gets the current selected column range
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        private SelectedRange GetColumnRange(IEnumerable<ColumnGroupHeader> list)
        {
            SelectedElements items = new SelectedElements();
 
            foreach (ColumnGroupHeader cgh in list)
                items.AddRange(cgh.StartDisplayIndex, cgh.EndDisplayIndex);
 
            if (items.Ranges.Count == 1)
                return (items.Ranges[0]);
 
            MessageBoxEx.Show("Invalid header range selection.");
 
            return (null);
        }
 
        #endregion
 
        #endregion
 
        #region GetNewHeader
 
        /// <summary>
        /// Creates and initializes a new GroupHeader.
        /// </summary>
        /// <param name="start">StartDisplayIndex</param>
        /// <param name="end">EndDisplayIndex</param>
        /// <returns></returns>
        private ColumnGroupHeader GetNewHeader(int start, int end)
        {
            ColumnGroupHeader cgh = new ColumnGroupHeader();
 
            cgh.Name = "New Header "   _HeaderCount  ;
            cgh.HeaderText = cgh.Name;
 
            cgh.MinRowHeight = 36;
            cgh.HeaderStyles.Default.AllowWrap = Tbool.True;
 
            cgh.StartDisplayIndex = start;
            cgh.EndDisplayIndex = end;
 
            return (cgh);
        }
 
        #endregion
 
        #region DeleteHeader
 
        /// <summary>
        /// Handles user delete header requests
        /// </summary>
        /// <param name="cgh"></param>
        private void DeleteHeader(ColumnGroupHeader cgh)
        {
            ColumnGroupHeaderCollection csc = cgh.Collection;
 
            csc.Remove(cgh);
 
            foreach (ColumnGroupHeader gh in cgh.GroupHeaders)
                csc.Add(gh);
        }
 
        #endregion
 
        #region CmiChangeSingleHeaderText
 
        /// <summary>
        /// Handles Group Header Text change requests
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CmiChangeSingleHeaderText(object sender, EventArgs e)
        {
            HeaderTextForm form = new HeaderTextForm();
 
            form.HeaderText = _HitGroupHeader.HeaderText;
 
            if (form.ShowDialog() == DialogResult.OK)
                _HitGroupHeader.HeaderText = form.HeaderText;
        }
 
        #endregion
 
        #region CmiDeleteSingleHeader
 
        /// <summary>
        /// Handles Deleting single header requests
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CmiDeleteSingleHeader(object sender, EventArgs e)
        {
            DeleteHeader(_HitGroupHeader);
        }
 
        #endregion
 
        #region CmiDeleteMultipleHeader
 
        /// <summary>
        /// Handles Deleting multiple header requests
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CmiDeleteMultipleHeader(object sender, EventArgs e)
        {
            List<ColumnGroupHeader> list = _SelectedGroupHeaders;
 
            if (list.Count > 0)
            {
                foreach (ColumnGroupHeader cgh in list)
                    DeleteHeader(cgh);
            }
        }
 
        #endregion
 
        #region CmiAddColumnHeader
 
        /// <summary>
        /// Handles add column header requests
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CmiAddColumnHeader(object sender, EventArgs e)
        {
            GridPanel panel = superGridControl1.PrimaryGrid;
            ColumnGroupHeader cgh = GetNewHeader(_StartColIndex, _EndColIndex);
 
            // If the _HitColumn has no parent header, then we are at the root
            // GroupHeader, defined by the GroupHeaders member in the ColumnHeader.
 
            ColumnGroupHeader pcgh = panel.ColumnHeader.GetParentHeader(_HitColumn) as ColumnGroupHeader;
 
            if (pcgh != null)
                pcgh.GroupHeaders.Add(cgh);
            else
                panel.ColumnHeader.GroupHeaders.Add(cgh);
        }
 
        #endregion
 
        #region InSingleHeaderVisibility
 
        #region InSingleHeaderVisibilityPopupShowing
 
        /// <summary>
        /// Updates the ShowColumnHeaders context menu display
        /// to reflect the current ShowColumnHeaders setting.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InSingleHeaderVisibilityPopupShowing(object sender, EventArgs e)
        {
            switch (_HitGroupHeader.ShowColumnHeaders)
            {
                case Tbool.True:
                    InHeaderVisibilityTrue.FontBold = true;
                    InHeaderVisibilityFalse.FontBold = false;
                    InHeaderVisibilityNotSet.FontBold = false;
                    break;
 
                case Tbool.False:
                    InHeaderVisibilityTrue.FontBold = false;
                    InHeaderVisibilityFalse.FontBold = true;
                    InHeaderVisibilityNotSet.FontBold = false;
                    break;
 
                default:
                    InHeaderVisibilityTrue.FontBold = false;
                    InHeaderVisibilityFalse.FontBold = false;
                    InHeaderVisibilityNotSet.FontBold = true;
                    break;
            }
        }
 
        #endregion
 
        #region InSingleSetVisNotSetClick
 
        /// <summary>
        /// Handles user setting ShowColumnHeaders = NotSet.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InSingleSetVisNotSetClick(object sender, EventArgs e)
        {
            _HitGroupHeader.ShowColumnHeaders = Tbool.NotSet;
        }
 
        #endregion
 
        #region InSingleSetVisTrueClick
 
        /// <summary>
        /// Handles user setting ShowColumnHeaders = True.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InSingleSetVisTrueClick(object sender, EventArgs e)
        {
            _HitGroupHeader.ShowColumnHeaders = Tbool.True;
        }
 
        #endregion
 
        #region InSingleSetVisFalseClick
 
        /// <summary>
        /// Handles user setting ShowColumnHeaders = False.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InSingleSetVisFalseClick(object sender, EventArgs e)
        {
            _HitGroupHeader.ShowColumnHeaders = Tbool.False;
        }
 
        #endregion
 
        #endregion
 
        #region CpColumnHeaderSelectedColorChanged
 
        /// <summary>
        /// Handles user Column Header color selection.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CpColumnHeaderSelectedColorChanged(object sender, EventArgs e)
        {
            ColorPickerDropDown cpd = sender as ColorPickerDropDown;
 
            if (cpd != null)
            {
                // If the user selects 'White' then reset the colors back
                // to their default state.
 
                if (Color.White.ToArgb() == cpd.SelectedColor.ToArgb())
                {
                    if (_HitColumn.IsSelected == true)
                    {
                        foreach (GridColumn column in superGridControl1.PrimaryGrid.SelectedColumns)
                            ResetHeaderBackground(column);
                    }
                    else
                    {
                        ResetHeaderBackground(_HitColumn);
                    }
                }
                else
                {
                    Color color1 = ControlPaint.LightLight(cpd.SelectedColor);
 
                    if (_HitColumn.IsSelected == true)
                    {
                        foreach (GridColumn column in superGridControl1.PrimaryGrid.SelectedColumns)
                            SetHeaderBackground(column, color1, cpd.SelectedColor);
                    }
                    else
                    {
                        SetHeaderBackground(_HitColumn, color1, cpd.SelectedColor);
                    }
                }
 
                superGridControl1.PrimaryGrid.ClearAll();
            }
        }
 
        #region SetHeaderBackground
 
        /// <summary>
        /// Sets the Column header background (Default and MouseOver), as well
        /// as the background color of the column cells.
        /// </summary>
        /// <param name="column"></param>
        /// <param name="color1"></param>
        /// <param name="color2"></param>
        private void SetHeaderBackground(GridColumn column, Color color1, Color color2)
        {
            column.HeaderStyles.Default.Background = new Background(color1, color2);
            column.HeaderStyles.MouseOver.Background = new Background(color2, color1);
 
            column.CellStyles.Default.Background = new Background(ControlPaint.Light(color1));
        }
 
        #endregion
 
        #region ResetHeaderBackground
 
        /// <summary>
        /// Handles resetting user set header/cell colors.
        /// </summary>
        /// <param name="column"></param>
        private void ResetHeaderBackground(GridColumn column)
        {
            column.HeaderStyles.Default.Background = null;
            column.HeaderStyles.MouseOver.Background = null;
 
            column.CellStyles.Default.Background = null;
        }
 
        #endregion
 
        #endregion
 
        #region CpHeaderSelectedColorChanged
 
        /// <summary>
        /// Handles user Group Header color selection.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CpHeaderSelectedColorChanged(object sender, EventArgs e)
        {
            ColorPickerDropDown cpd = sender as ColorPickerDropDown;
 
            if (cpd != null)
            {
                List<ColumnGroupHeader> list = _SelectedGroupHeaders;
 
                if (list.Count > 0)
                {
                    // If the user selects 'White' then reset the colors back
                    // to their default state.
 
                    if (Color.White.ToArgb() == cpd.SelectedColor.ToArgb())
                    {
                        foreach (ColumnGroupHeader cgh in list)
                            ResetHeaderBackground(cgh);
                    }
                    else
                    {
                        Color color1 = ControlPaint.LightLight(cpd.SelectedColor);
 
                        foreach (ColumnGroupHeader cgh in list)
                            SetHeaderBackground(cgh, color1, cpd.SelectedColor);
                    }
                }
 
                superGridControl1.PrimaryGrid.ClearAll();
            }
        }
 
        #region SetHeaderBackground
 
        /// <summary>
        /// Sets the Group header background (Default and MouseOver), as well
        /// as the background color of the column cells contained in the Group.
        /// </summary>
        /// <param name="cgh"></param>
        /// <param name="color1"></param>
        /// <param name="color2"></param>
        private void SetHeaderBackground(ColumnGroupHeader cgh, Color color1, Color color2)
        {
            GridColumnCollection columns = superGridControl1.PrimaryGrid.Columns;
 
            cgh.HeaderStyles.Default.Background = new Background(color1, color2);
            cgh.HeaderStyles.MouseOver.Background = new Background(color2, color1);
 
            Color color3 = ControlPaint.LightLight(color1);
 
            for (int i = cgh.StartDisplayIndex; i <= cgh.EndDisplayIndex; i  )
                columns.ColumnAtDisplayIndex(i).CellStyles.Default.Background = new Background(color3);
        }
 
        #endregion
 
        #region ResetHeaderBackground
 
        /// <summary>
        /// Handles resetting user set Group Header colors.
        /// </summary>
        /// <param name="cgh"></param>
        private void ResetHeaderBackground(ColumnGroupHeader cgh)
        {
            GridColumnCollection columns = superGridControl1.PrimaryGrid.Columns;
 
            cgh.HeaderStyles.Default.Background = null;
            cgh.HeaderStyles.MouseOver.Background = null;
 
            for (int i = cgh.StartDisplayIndex; i <= cgh.EndDisplayIndex; i  )
                columns.ColumnAtDisplayIndex(i).CellStyles.Default.Background = null;
        }
 
        #endregion
 
        #endregion
 
        #region InSingleHeaderPopupClose
 
        /// <summary>
        /// Clears all current selection when the InSingleHeader
        /// popup menu is closed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InSingleHeaderPopupClose(object sender, EventArgs e)
        {
            superGridControl1.PrimaryGrid.ClearAll();
        }
 
        #endregion
    }
}

标签: GridView 实例 DotNet

实例下载地址

DotNetBar的SuperGrid GridView实例源码

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

第 1 楼 jim_fan 发表于: 2016-09-09 09:50 47
下载下来没法用!

支持(0) 盖楼(回复)

第 2 楼 hmilycdf512 发表于: 2017-11-17 13:01 52
程序中,是否包括SuperGridView.ocx控件

支持(0) 盖楼(回复)

第 3 楼 pinpinpin 发表于: 2020-05-23 10:21 35
一个残缺的项目

支持(0) 盖楼(回复)

第 4 楼 sunyzth 发表于: 2020-08-26 16:04 12
不能使用,没有DLL文件。

支持(0) 盖楼(回复)

发表评论

(您的评论需要经过审核才能显示)

查看所有4条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警