Example #1
0
        private void CreateColumns(SourceGrid.DataGridColumns columns,
                                   DevAge.ComponentModel.IBoundList bindList)
        {
            SourceGrid.Cells.Editors.TextBoxNumeric numericEditor = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(decimal));
            numericEditor.TypeConverter = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(decimal), "N");
            numericEditor.AllowNull     = true;

            //Borders
            DevAge.Drawing.RectangleBorder border = new DevAge.Drawing.RectangleBorder(new DevAge.Drawing.BorderLine(Color.ForestGreen), new DevAge.Drawing.BorderLine(Color.ForestGreen));

            //Standard Views
            SourceGrid.Cells.Views.Link viewLink = new SourceGrid.Cells.Views.Link();
            viewLink.BackColor      = Color.DarkSeaGreen;
            viewLink.Border         = border;
            viewLink.ImageAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            viewLink.TextAlignment  = DevAge.Drawing.ContentAlignment.MiddleCenter;
            SourceGrid.Cells.Views.Cell viewString = new SourceGrid.Cells.Views.Cell();
            viewString.BackColor     = Color.DarkSeaGreen;
            viewString.Border        = border;
            viewString.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft;
            SourceGrid.Cells.Views.Cell viewNumeric = new SourceGrid.Cells.Views.Cell();
            viewNumeric.BackColor     = Color.DarkSeaGreen;
            viewNumeric.Border        = border;
            viewNumeric.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight;
            SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell();
            viewImage.BackColor      = Color.DarkSeaGreen;
            viewImage.Border         = border;
            viewImage.ImageStretch   = false;
            viewImage.ImageAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

            //Create columns
            SourceGrid.DataGridColumn gridColumn;

            gridColumn = dataGrid.Columns.Add(null, "", new SourceGrid.Cells.Link());
            gridColumn.DataCell.AddController(new LinkClickDelete());
            gridColumn.DataCell.View = viewLink;
            ((SourceGrid.Cells.Link)gridColumn.DataCell).Image = Properties.Resources.trash.ToBitmap();

            gridColumn = dataGrid.Columns.Add("Flag", "Flag", new SourceGrid.Cells.DataGrid.Image());
            gridColumn.DataCell.View = viewImage;

            gridColumn = dataGrid.Columns.Add("Country", "Country", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Uniform", "Uniform", new SourceGrid.Cells.DataGrid.Image());
            gridColumn.DataCell.View = viewImage;

            gridColumn = dataGrid.Columns.Add("Capital", "Capital", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Population", "Population", typeof(decimal));
            gridColumn.DataCell.Editor = numericEditor;
            gridColumn.DataCell.View   = viewNumeric;

            gridColumn = dataGrid.Columns.Add("Surface", "Surface", typeof(decimal));
            gridColumn.DataCell.Editor = numericEditor;
            gridColumn.DataCell.View   = viewNumeric;

            gridColumn = dataGrid.Columns.Add("Languages", "Languages", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Currency", "Currency", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Major Cities", "Major Cities", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("National Holiday", "National Holiday", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Lowest point", "Lowest point", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Highest point", "Highest point", typeof(string));
            gridColumn.DataCell.View = viewString;

            //Create a conditional view
            foreach (SourceGrid.DataGridColumn col in columns)
            {
                SourceGrid.Conditions.ICondition condition =
                    SourceGrid.Conditions.ConditionBuilder.AlternateView(col.DataCell.View,
                                                                         Color.LightGray, Color.Black);
                col.Conditions.Add(condition);
            }
        }
		private void CreateColumns(SourceGrid.DataGridColumns columns,
                                    DevAge.ComponentModel.IBoundList bindList)
		{
			SourceGrid.Cells.Editors.TextBoxNumeric numericEditor = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(decimal));
			numericEditor.TypeConverter = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(decimal), "N");
			numericEditor.AllowNull = true;

			//Borders
			DevAge.Drawing.RectangleBorder border = new DevAge.Drawing.RectangleBorder(new DevAge.Drawing.BorderLine(Color.ForestGreen), new DevAge.Drawing.BorderLine(Color.ForestGreen));

			//Standard Views
			SourceGrid.Cells.Views.Link viewLink = new SourceGrid.Cells.Views.Link();
			viewLink.BackColor = Color.DarkSeaGreen;
			viewLink.Border = border;
			viewLink.ImageAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
			viewLink.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
			SourceGrid.Cells.Views.Cell viewString = new SourceGrid.Cells.Views.Cell();
			viewString.BackColor = Color.DarkSeaGreen;
			viewString.Border = border;
			viewString.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft;
			SourceGrid.Cells.Views.Cell viewNumeric = new SourceGrid.Cells.Views.Cell();
			viewNumeric.BackColor = Color.DarkSeaGreen;
			viewNumeric.Border = border;
			viewNumeric.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight;
			SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell();
			viewImage.BackColor = Color.DarkSeaGreen;
			viewImage.Border = border;
			viewImage.ImageStretch = false;
			viewImage.ImageAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

            //Create columns
            SourceGrid.DataGridColumn gridColumn;

            gridColumn = dataGrid.Columns.Add(null, "", new SourceGrid.Cells.Link());
            gridColumn.DataCell.AddController(new LinkClickDelete());
            gridColumn.DataCell.View = viewLink;
            ((SourceGrid.Cells.Link)gridColumn.DataCell).Image = Properties.Resources.trash.ToBitmap();

            gridColumn = dataGrid.Columns.Add("Flag", "Flag", new SourceGrid.Cells.DataGrid.Image());
            gridColumn.DataCell.View = viewImage;

            gridColumn = dataGrid.Columns.Add("Country", "Country", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Uniform", "Uniform", new SourceGrid.Cells.DataGrid.Image());
            gridColumn.DataCell.View = viewImage;

            gridColumn = dataGrid.Columns.Add("Capital", "Capital", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Population", "Population", typeof(decimal));
            gridColumn.DataCell.Editor = numericEditor;
            gridColumn.DataCell.View = viewNumeric;

            gridColumn = dataGrid.Columns.Add("Surface", "Surface", typeof(decimal));
            gridColumn.DataCell.Editor = numericEditor;
            gridColumn.DataCell.View = viewNumeric;

            gridColumn = dataGrid.Columns.Add("Languages", "Languages", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Currency", "Currency", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Major Cities", "Major Cities", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("National Holiday", "National Holiday", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Lowest point", "Lowest point", typeof(string));
            gridColumn.DataCell.View = viewString;

            gridColumn = dataGrid.Columns.Add("Highest point", "Highest point", typeof(string));
            gridColumn.DataCell.View = viewString;

            //Create a conditional view
            foreach (SourceGrid.DataGridColumn col in columns)
            {
                SourceGrid.Conditions.ICondition condition = 
                                SourceGrid.Conditions.ConditionBuilder.AlternateView(col.DataCell.View,
                                                                            Color.LightGray, Color.Black);
                col.Conditions.Add(condition);
            }
		}
Example #3
0
        private void InitializeAccountDataGrid()
        {
            #region InitializeAccountDataGrid

            this.accountDataTable = new System.Data.DataTable();
            this.accountDataTable.Columns.Add(Account_Column_Order, typeof(int));
            this.accountDataTable.Columns.Add(Account_Column_AccountId, typeof(int));
            this.accountDataTable.Columns.Add(Account_Column_TopMost, typeof(short));
            this.accountDataTable.Columns.Add(Account_Column_Name, typeof(string));
            this.accountDataTable.Columns.Add(Account_Column_LoginName, typeof(string));
            this.accountDataTable.Columns.Add(Account_Column_Secret, typeof(SecretRank));
            this.accountDataTable.Columns.Add(Account_Column_Email, typeof(string));
            this.accountDataTable.Columns.Add(Account_Column_Mobile, typeof(string));
            this.accountDataTable.Columns.Add(Account_Column_URL, typeof(string));
            this.accountDataTable.Columns.Add(Account_Column_CreateTime, typeof(System.DateTime));
            this.accountDataTable.Columns.Add(Account_Column_UpdateTime, typeof(System.DateTime));

            this.dataGridAccount.BorderStyle    = BorderStyle.Fixed3D;
            this.dataGridAccount.BackColor      = System.Drawing.SystemColors.AppWorkspace;
            this.dataGridAccount.Font           = ApplicationDefines.DefaultDataGridCellFont;
            this.dataGridAccount.Rows.RowHeight = 30;
            this.dataGridAccount.Rows.SetHeight(0, 30);
            this.dataGridAccount.SelectionMode = SourceGrid.GridSelectionMode.Cell;
            this.dataGridAccount.Selection.EnableMultiSelection = true;
            this.dataGridAccount.ClipboardMode = SourceGrid.ClipboardMode.All;

            var tmpGridSelection = this.dataGridAccount.Selection as SourceGrid.Selection.SelectionBase;
            if (tmpGridSelection != null)
            {
                tmpGridSelection.Border    = tmpGridSelection.Border.SetColor(System.Drawing.Color.Blue);
                tmpGridSelection.BackColor = System.Drawing.Color.FromArgb(60, tmpGridSelection.BackColor);
            }

            SourceGrid.DataGridColumn tmpGridColumn;
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_Order, SafePassResource.DataGridAccountColumnOrderNo, typeof(int));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_AccountId, SafePassResource.DataGridAccountColumnAccountGuid, typeof(string));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_TopMost, SafePassResource.DataGridAccountColumnTopMost, typeof(short));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_Name, SafePassResource.DataGridAccountColumnName, typeof(string));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_Secret, SafePassResource.DataGridAccountColumnSecret, typeof(SecretRank));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_LoginName, SafePassResource.DataGridAccountColumnLoginName, typeof(string));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_Mobile, SafePassResource.DataGridAccountColumnMobile, typeof(string));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_Email, SafePassResource.DataGridAccountColumnEmail, typeof(string));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_CreateTime, SafePassResource.DataGridAccountColumnCreateTime, typeof(System.DateTime));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_UpdateTime, SafePassResource.DataGridAccountColumnUpdateTime, typeof(System.DateTime));
            tmpGridColumn = this.dataGridAccount.Columns.Add(Account_Column_URL, SafePassResource.DataGridAccountColumnURL, typeof(string));

            var tmpDateTimeFormat    = ApplicationDefines.DateTimeFormat;
            var dateTimeParseFormats = new string[] { tmpDateTimeFormat };
            var tmpDateTimeStyles    = System.Globalization.DateTimeStyles.AllowInnerWhite | System.Globalization.DateTimeStyles.AllowLeadingWhite | System.Globalization.DateTimeStyles.AllowTrailingWhite | System.Globalization.DateTimeStyles.AllowWhiteSpaces;
            var tmpDateTimeEditor    = new SourceGrid.Cells.Editors.TextBoxUITypeEditor(typeof(System.DateTime));
            tmpDateTimeEditor.TypeConverter = new DevAge.ComponentModel.Converter.DateTimeTypeConverter(tmpDateTimeFormat, dateTimeParseFormats, tmpDateTimeStyles);

            var tmpDataSource = new DevAge.ComponentModel.BoundDataView(this.accountDataTable.DefaultView);
            tmpDataSource.AllowNew          = false;
            tmpDataSource.AllowSort         = true;
            this.dataGridAccount.DataSource = tmpDataSource;

            var tmpGridColor  = System.Drawing.SystemColors.ActiveBorder;
            var tmpGridBorder = new DevAge.Drawing.RectangleBorder(new DevAge.Drawing.BorderLine(tmpGridColor, 0), new DevAge.Drawing.BorderLine(tmpGridColor));

            var tmpGridLinkCellView = new SourceGrid.Cells.Views.Link();
            tmpGridLinkCellView.Font = ApplicationDefines.DefaultDataGridCellFont;

            var tmpAlignCenterCellView = new SourceGrid.Cells.Views.Cell();
            tmpAlignCenterCellView.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            tmpAlignCenterCellView.Font          = ApplicationDefines.DefaultDataGridCellFont;

            var tmpLoginNameCellView = new SourceGrid.Cells.Views.Cell();
            tmpLoginNameCellView.Font = new System.Drawing.Font("Consolas", 10, System.Drawing.FontStyle.Regular);

            this.SecretCellRank0               = new SourceGrid.Cells.Views.Cell();
            this.SecretCellRank0.ForeColor     = System.Drawing.Color.White;
            this.SecretCellRank0.BackColor     = Program.Config.Application.Security.SecretRank.Rank0BackColor;
            this.SecretCellRank0.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            this.SecretCellRank0.Font          = ApplicationDefines.DefaultDataGridCellFont;

            this.SecretCellRank1               = new SourceGrid.Cells.Views.Cell();
            this.SecretCellRank1.ForeColor     = System.Drawing.Color.White;
            this.SecretCellRank1.BackColor     = Program.Config.Application.Security.SecretRank.Rank1BackColor;
            this.SecretCellRank1.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            this.SecretCellRank1.Font          = ApplicationDefines.DefaultDataGridCellFont;

            this.SecretCellRank2               = new SourceGrid.Cells.Views.Cell();
            this.SecretCellRank2.ForeColor     = System.Drawing.Color.White;
            this.SecretCellRank2.BackColor     = Program.Config.Application.Security.SecretRank.Rank2BackColor;
            this.SecretCellRank2.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            this.SecretCellRank2.Font          = ApplicationDefines.DefaultDataGridCellFont;

            this.SecretCellRank3               = new SourceGrid.Cells.Views.Cell();
            this.SecretCellRank3.ForeColor     = System.Drawing.Color.White;
            this.SecretCellRank3.BackColor     = Program.Config.Application.Security.SecretRank.Rank3BackColor;
            this.SecretCellRank3.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            this.SecretCellRank3.Font          = ApplicationDefines.DefaultDataGridCellFont;

            var tmpTopMostModel = new SourceGrid.Cells.Views.Cell();
            tmpTopMostModel.ImageAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            this.GridCellTopMost           = new SourceGrid.Cells.Cell();
            this.GridCellTopMost.View      = new SourceGrid.Cells.Views.Cell(tmpTopMostModel);
            this.GridCellTopMost.Image     = HuiruiSoft.Safe.Properties.Resources.TopMost;

            this.GridCellTopNone       = new SourceGrid.Cells.Cell();
            this.GridCellTopNone.View  = new SourceGrid.Cells.Views.Cell(tmpTopMostModel);
            this.GridCellTopNone.Image = HuiruiSoft.Safe.Properties.Resources.TopNone;

            var tmpConditionTopMost = new SourceGrid.Conditions.ConditionCell(this.GridCellTopMost);
            tmpConditionTopMost.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
            {
                var tmpDataRow = (System.Data.DataRowView)itemRow;
                return(tmpDataRow[Account_Column_TopMost] is short && (short)tmpDataRow[Account_Column_TopMost] > 0);
            };

            var tmpConditionTopNone = new SourceGrid.Conditions.ConditionCell(this.GridCellTopNone);
            tmpConditionTopNone.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
            {
                var tmpDataRow = (System.Data.DataRowView)itemRow;
                return(tmpDataRow[Account_Column_TopMost] is short && (short)tmpDataRow[Account_Column_TopMost] <= 0);
            };

            var tmpConditionRank0 = new SourceGrid.Conditions.ConditionView(this.SecretCellRank0);
            tmpConditionRank0.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
            {
                var tmpDataRow = (System.Data.DataRowView)itemRow;
                return(tmpDataRow[Account_Column_Secret] is ushort && (ushort)tmpDataRow[Account_Column_Secret] == (ushort)SecretRank.¹«¿ª);
            };

            var tmpConditionRank1 = new SourceGrid.Conditions.ConditionView(this.SecretCellRank1);
            tmpConditionRank1.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
            {
                var tmpDataRow = (System.Data.DataRowView)itemRow;
                return(tmpDataRow[Account_Column_Secret] is ushort && (ushort)tmpDataRow[Account_Column_Secret] == (ushort)SecretRank.ÃØÃÜ);
            };

            var tmpConditionRank2 = new SourceGrid.Conditions.ConditionView(this.SecretCellRank2);
            tmpConditionRank2.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
            {
                var tmpDataRow = (System.Data.DataRowView)itemRow;
                return(tmpDataRow[Account_Column_Secret] is ushort && (ushort)tmpDataRow[Account_Column_Secret] == (ushort)SecretRank.»úÃÜ);
            };

            var tmpConditionRank3 = new SourceGrid.Conditions.ConditionView(this.SecretCellRank3);
            tmpConditionRank3.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
            {
                var tmpDataRow = (System.Data.DataRowView)itemRow;
                return(tmpDataRow[Account_Column_Secret] is ushort && (ushort)tmpDataRow[Account_Column_Secret] == (ushort)SecretRank.¾øÃÜ);
            };

            for (int index = 0; index < this.dataGridAccount.Columns.Count; index++)
            {
                var tmpCurrentColumn = this.dataGridAccount.Columns[index];
                tmpCurrentColumn.HeaderCell.View.Border        = tmpGridBorder;
                tmpCurrentColumn.HeaderCell.View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

                if (tmpCurrentColumn.DataCell.Editor != null)
                {
                    tmpCurrentColumn.DataCell.Editor.EnableEdit = false;
                }

                switch (tmpCurrentColumn.PropertyName)
                {
                case Account_Column_AccountId:
                case Account_Column_CreateTime:
                    tmpCurrentColumn.Width   = 150;
                    tmpCurrentColumn.Visible = false;
                    break;

                case Account_Column_TopMost:
                    tmpCurrentColumn.Width = 50;
                    tmpCurrentColumn.Conditions.Add(tmpConditionTopNone);
                    tmpCurrentColumn.Conditions.Add(tmpConditionTopMost);
                    break;

                case Account_Column_Order:
                    tmpCurrentColumn.Width         = 50;
                    tmpCurrentColumn.DataCell.View = tmpAlignCenterCellView;
                    break;

                case Account_Column_Name:
                    tmpCurrentColumn.Width = 175;
                    break;

                case Account_Column_Secret:
                    tmpCurrentColumn.Width = 80;
                    tmpCurrentColumn.Conditions.Add(tmpConditionRank0);
                    tmpCurrentColumn.Conditions.Add(tmpConditionRank1);
                    tmpCurrentColumn.Conditions.Add(tmpConditionRank2);
                    tmpCurrentColumn.Conditions.Add(tmpConditionRank3);
                    break;

                case Account_Column_LoginName:
                    tmpCurrentColumn.Width         = 200;
                    tmpCurrentColumn.DataCell.View = tmpLoginNameCellView;
                    break;

                case Account_Column_Mobile:
                    tmpCurrentColumn.Width         = 120;
                    tmpCurrentColumn.DataCell.View = tmpAlignCenterCellView;
                    break;

                case Account_Column_Email:
                    tmpCurrentColumn.Width = 200;
                    break;

                case Account_Column_URL:
                    tmpCurrentColumn.Width         = 270;
                    tmpCurrentColumn.DataCell.View = tmpGridLinkCellView;
                    tmpCurrentColumn.DataCell.AddController(new LinkClickController());
                    break;

                case Account_Column_UpdateTime:
                    tmpCurrentColumn.Width                      = 156;
                    tmpCurrentColumn.DataCell.Editor            = tmpDateTimeEditor;
                    tmpCurrentColumn.DataCell.Editor.EnableEdit = false;
                    tmpCurrentColumn.DataCell.View              = tmpAlignCenterCellView;
                    break;
                }
            }

            #endregion InitializeAccountDataGrid
        }
Example #4
0
        private static void CreateColumns(SourceGrid.DataGridColumns columns, DataTable sourceTable)
        {
            SourceGrid.Cells.Editors.TextBoxNumeric numericEditor = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(decimal));
            numericEditor.TypeConverter = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(decimal), "N");
            numericEditor.AllowNull     = true;
            SourceGrid.Cells.Editors.TextBox stringEditor = new SourceGrid.Cells.Editors.TextBox(typeof(string));

            //Borders
            DevAge.Drawing.RectangleBorder border = new DevAge.Drawing.RectangleBorder(new DevAge.Drawing.Border(Color.ForestGreen), new DevAge.Drawing.Border(Color.ForestGreen));

            //Standard Views
            SourceGrid.Cells.Views.Link viewLink = new SourceGrid.Cells.Views.Link();
            viewLink.BackColor      = Color.DarkSeaGreen;
            viewLink.Border         = border;
            viewLink.ImageAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            viewLink.TextAlignment  = DevAge.Drawing.ContentAlignment.MiddleCenter;
            SourceGrid.Cells.Views.Cell viewString = new SourceGrid.Cells.Views.Cell();
            viewString.BackColor     = Color.DarkSeaGreen;
            viewString.Border        = border;
            viewString.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft;
            SourceGrid.Cells.Views.Cell viewNumeric = new SourceGrid.Cells.Views.Cell();
            viewNumeric.BackColor     = Color.DarkSeaGreen;
            viewNumeric.Border        = border;
            viewNumeric.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight;
            SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell();
            viewImage.BackColor      = Color.DarkSeaGreen;
            viewImage.Border         = border;
            viewImage.ImageStretch   = false;
            viewImage.ImageAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

            Color alternateColor = Color.LightGray;

            DataColumn dataColumn;
            DataGridColumnAlternate gridColumn;

            SourceGrid.Cells.ICellVirtual dataCell;

            //Create columns

            dataCell = new SourceGrid.Cells.Link("");
            dataCell.AddController(new LinkClickDelete());
            dataCell.View = viewLink;
            ((SourceGrid.Cells.Link)dataCell).Image = Properties.Resources.trash.ToBitmap();
            gridColumn = new DataGridColumnAlternate(columns.Grid, null, "Delete", dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);
            //Add an image to the header

            dataColumn    = sourceTable.Columns["Flag"];
            dataCell      = new SourceGrid.Cells.DataGrid.Image(dataColumn);
            dataCell.View = viewImage;
            gridColumn    = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Country"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewString;
            dataCell.Editor = stringEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn    = sourceTable.Columns["Uniform"];
            dataCell      = new SourceGrid.Cells.DataGrid.Image(dataColumn);
            dataCell.View = viewImage;
            gridColumn    = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Capital"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewString;
            dataCell.Editor = stringEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Population"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewNumeric;
            dataCell.Editor = numericEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Surface"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewNumeric;
            dataCell.Editor = numericEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Languages"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewString;
            dataCell.Editor = stringEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Currency"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewString;
            dataCell.Editor = stringEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Major Cities"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewString;
            dataCell.Editor = stringEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["National Holiday"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewString;
            dataCell.Editor = stringEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Lowest point"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewString;
            dataCell.Editor = stringEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);

            dataColumn      = sourceTable.Columns["Highest point"];
            dataCell        = new SourceGrid.Cells.DataGrid.Cell(dataColumn);
            dataCell.View   = viewString;
            dataCell.Editor = stringEditor;
            gridColumn      = new DataGridColumnAlternate(columns.Grid, dataColumn, dataColumn.Caption, dataCell, alternateColor);
            columns.Insert(columns.Count, gridColumn);
        }