示例#1
0
        /// <summary>
        /// Easy method to add a new Text column.
        ///
        /// </summary>
        /// <param name="AColumnTitle">Title of the HeaderColumn</param>
        /// <param name="ADataColumn">DataColumn to which this column should be DataBound</param>
        /// <param name="AColumnWidth">Column width in pixels (-1 for automatic width)</param>
        /// <param name="AController"></param>
        /// <param name="AEditor">An instance of an Editor (based on ICellVirtual.Editor)</param>
        /// <param name="AModel"></param>
        /// <param name="AView"></param>
        /// <param name="AConditionView"></param>
        ///
        /// <returns>void</returns>
        public void AddTextColumn(String AColumnTitle,
            DataColumn ADataColumn,
            Int16 AColumnWidth,
            ControllerBase AController,
            EditorBase AEditor,
            ModelContainer AModel,
            IView AView,
            SourceGrid.Conditions.ConditionView AConditionView)
        {
            SourceGrid.Cells.ICellVirtual ADataCell;
            SourceGrid.DataGridColumn AGridColumn;

            if (ADataColumn == null)
            {
                throw new ArgumentNullException("ADataColumn", "ADataColumn must not be nil!");
            }

            ADataCell = new SourceGrid.Cells.DataGrid.Cell();

            if (AController != null)
            {
                MessageBox.Show("AController <> nil!");
                try
                {
                    ADataCell.AddController(AController);
                }
                catch (Exception Exp)
                {
                    MessageBox.Show("TSgrdDataGrid.AddTextColumn: Exeption: " + Exp.ToString());
                }
            }

            if (AEditor != null)
            {
                ADataCell.Editor = AEditor;
            }

            if (AModel != null)
            {
                ADataCell.Model = AModel;
            }

            if (AView != null)
            {
                ADataCell.View = AView;
            }

            AGridColumn = new TSgrdTextColumn(this, ADataColumn, AColumnTitle, ADataCell, AColumnWidth, FSortableHeaders);

            if (AConditionView != null)
            {
                AGridColumn.Conditions.Add(AConditionView);
            }

            this.Columns.Insert(this.Columns.Count, AGridColumn);
        }
示例#2
0
        /// <summary>
        /// Easy method to add a new CheckBox column.
        /// </summary>
        /// <param name="AColumnTitle">Title of the HeaderColumn</param>
        /// <param name="ADataColumn">DataColumn to which this column should be DataBound</param>
        /// <param name="AColumnWidth">Column width in pixels (-1 for automatic width)</param>
        /// <param name="AEditor"></param>
        /// <param name="AReadOnly">Set to true if the column should be read-only</param>
        /// <returns>void</returns>
        public void AddCheckBoxColumn(String AColumnTitle, DataColumn ADataColumn, Int16 AColumnWidth, EditorBase AEditor, bool AReadOnly)
        {
            if (ADataColumn == null)
            {
                throw new ArgumentNullException("ADataColumn", "ADataColumn must not be nil!");
            }

            SourceGrid.Cells.ICellVirtual ADataCell = new SourceGrid.Cells.DataGrid.CheckBox();

            if (AEditor != null)
            {
                ADataCell.Editor = AEditor;
            }

            SourceGrid.DataGridColumn AGridColumn = new TSgrdTextColumn(this, ADataColumn, AColumnTitle, ADataCell, AColumnWidth, FSortableHeaders);

            if (AReadOnly)
            {
                ADataCell.Editor.EnableEdit = false;
            }

            this.Columns.Insert(this.Columns.Count, AGridColumn);
        }