Exemple #1
0
        private void brAddRow_Click(object sender, System.EventArgs e)
        {
            SourceGrid.Cells.Link link = new SourceGrid.Cells.Link("http://www.codeproject.com");
            link.AddController(mController_Link);

            grid1.Rows.Insert(grid1.RowsCount,
                              new SourceGrid.Cells.RowHeader(null),
                              new SourceGrid.Cells.Cell(grid1.RowsCount, mEditor_Id),
                              new SourceGrid.Cells.Cell(mEditor_Name.DefaultValue, mEditor_Name),
                              new SourceGrid.Cells.Cell(mEditor_Address.DefaultValue, mEditor_Address),
                              new SourceGrid.Cells.Cell(mEditor_City.DefaultValue, mEditor_City),
                              new SourceGrid.Cells.Cell(mEditor_BirthDay.DefaultValue, mEditor_BirthDay),
                              new SourceGrid.Cells.Cell(mEditor_Country.DefaultValue, mEditor_Country),
                              new SourceGrid.Cells.Cell(mEditor_Price.DefaultValue, mEditor_Price),
                              new SourceGrid.Cells.CheckBox(null, false),
                              link);

            grid1.Selection.FocusRow(grid1.RowsCount - 1);
        }
        private void brAddRow_Click(object sender, System.EventArgs e)
        {
            int row = grid1.RowsCount;

            grid1.Rows.Insert(row);

            grid1[row, 0] = new SourceGrid.Cells.RowHeader(null);
            grid1[row, 1] = new SourceGrid.Cells.Cell(grid1.RowsCount, mEditor_Id);
            grid1[row, 2] = new SourceGrid.Cells.Cell(mEditor_Name.DefaultValue, mEditor_Name);
            grid1[row, 3] = new SourceGrid.Cells.Cell(mEditor_Address.DefaultValue, mEditor_Address);
            grid1[row, 4] = new SourceGrid.Cells.Cell(mEditor_City.DefaultValue, mEditor_City);
            grid1[row, 5] = new SourceGrid.Cells.Cell(mEditor_BirthDay.DefaultValue, mEditor_BirthDay);
            grid1[row, 6] = new SourceGrid.Cells.Cell(mEditor_Country.DefaultValue, mEditor_Country);
            grid1[row, 7] = new SourceGrid.Cells.Cell(mEditor_Price.DefaultValue, mEditor_Price);
            grid1[row, 8] = new SourceGrid.Cells.CheckBox(null, false);

            SourceGrid.Cells.Link link = new SourceGrid.Cells.Link("http://www.codeproject.com");
            link.AddController(mController_Link);
            grid1[row, 9] = link;

            grid1.Selection.FocusRow(row);
        }
Exemple #3
0
		private void brAddRow_Click(object sender, System.EventArgs e)
		{
            int row = grid1.RowsCount;
			grid1.Rows.Insert(row);

            grid1[row, 0] = new SourceGrid.Cells.RowHeader(null);
            grid1[row, 1] = new SourceGrid.Cells.Cell(grid1.RowsCount, mEditor_Id);
			grid1[row, 2] = new SourceGrid.Cells.Cell(mEditor_Name.DefaultValue, mEditor_Name);
			grid1[row, 3] = new SourceGrid.Cells.Cell(mEditor_Address.DefaultValue,mEditor_Address);
			grid1[row, 4] = new SourceGrid.Cells.Cell(mEditor_City.DefaultValue,mEditor_City);
			grid1[row, 5] = new SourceGrid.Cells.Cell(mEditor_BirthDay.DefaultValue, mEditor_BirthDay);
			grid1[row, 6] = new SourceGrid.Cells.Cell(mEditor_Country.DefaultValue, mEditor_Country);
			grid1[row, 7] = new SourceGrid.Cells.Cell(mEditor_Price.DefaultValue, mEditor_Price);
			grid1[row, 8] = new SourceGrid.Cells.CheckBox(null, false);

            SourceGrid.Cells.Link link = new SourceGrid.Cells.Link("http://www.codeproject.com");
            link.AddController(mController_Link);
            grid1[row, 9] = link;

            grid1.Selection.FocusRow(row);
		}
Exemple #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);
        }