static OneClickTabCell() { view = new SourceGrid.Cells.Views.Cell(); ((TextGDI)view.ElementText).StringFormat.SetTabStops(0.0f, tabPosition); editor = new SourceGrid.Cells.Editors.TextBox(typeof(string)); editor.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick; editor.Control.AcceptsReturn = false; editor.Control.AcceptsTab = true; editor.Control.Multiline = true; editor.Control.WordWrap = true; }
static OneClickCell() { editor = new SourceGrid.Cells.Editors.TextBox(typeof(string)); editor.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick; }
/// <summary> /// add a column that shows a PartnerKey value (include leading zeros to display a 10 digit number) /// </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> public void AddPartnerKeyColumn(String AColumnTitle, DataColumn ADataColumn, Int16 AColumnWidth) { SourceGrid.Cells.Editors.TextBox PartnerKeyEditor = new SourceGrid.Cells.Editors.TextBox(typeof(Int64)); PartnerKeyEditor.TypeConverter = new PartnerKeyConverter(); PartnerKeyEditor.EditableMode = EditableMode.None; AddTextColumn(AColumnTitle, ADataColumn, AColumnWidth, null, PartnerKeyEditor, null, null, null); }
/// <summary> /// add a column that shows a boolean value. /// this allows to show a specific text for true and another text for false. /// </summary> /// <param name="AColumnTitle">Title of the HeaderColumn</param> /// <param name="ADataColumn">DataColumn to which this column should be DataBound</param> /// <param name="ATextTrue">text to be displayed in the column if the value is true</param> /// <param name="ATextFalse">text to be displayed in the column if the value is false</param> public void AddBooleanColumn(String AColumnTitle, DataColumn ADataColumn, string ATextTrue, string ATextFalse) { SourceGrid.Cells.Editors.TextBox BooleanEditor = new SourceGrid.Cells.Editors.TextBox(typeof(bool)); BooleanEditor.TypeConverter = new BooleanConverter(ATextTrue, ATextFalse); BooleanEditor.EditableMode = EditableMode.None; AddTextColumn(AColumnTitle, ADataColumn, -1, null, BooleanEditor, null, null, null); }
/// <summary> /// add a column that shows a currency value. /// aligns the value to the right. /// prints number in red if it is negative /// </summary> /// <param name="AColumnTitle">Title of the HeaderColumn</param> /// <param name="ADataColumn">DataColumn to which this column should be DataBound</param> /// <param name="ADecimalDigits">Number of digits after the currency decimal point</param> public void AddCurrencyColumn(String AColumnTitle, DataColumn ADataColumn, int ADecimalDigits) { SourceGrid.Cells.Editors.TextBox CurrencyEditor = new SourceGrid.Cells.Editors.TextBox(typeof(decimal)); CurrencyEditor.TypeConverter = new Ict.Common.TypeConverter.TCurrencyConverter( ADataColumn.ColumnName, Thread.CurrentThread.CurrentCulture.NumberFormat, ADecimalDigits); CurrencyEditor.EditableMode = EditableMode.None; // Non-negative value View SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; // Negative value View SourceGrid.Cells.Views.Cell NegativeNumberView = new SourceGrid.Cells.Views.Cell(); NegativeNumberView.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; NegativeNumberView.ForeColor = Color.Red; // Condition for negative value View SourceGrid.Conditions.ConditionView selectedConditionNegative = new SourceGrid.Conditions.ConditionView(NegativeNumberView); selectedConditionNegative.EvaluateFunction = (delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow) { DataRowView row = (DataRowView)itemRow; return row[ADataColumn.ColumnName] is decimal && (decimal)row[ADataColumn.ColumnName] < 0; }); AddTextColumn(AColumnTitle, ADataColumn, -1, null, CurrencyEditor, null, view, selectedConditionNegative); }
/// <summary> /// add a column that shows a decimal value. /// aligns the value to the right. /// </summary> /// <param name="AColumnTitle">Title of the HeaderColumn</param> /// <param name="ADataColumn">DataColumn to which this column should be DataBound</param> /// <param name="ADecimalDigits">Number of digits after the numeric decimal point</param> public void AddDecimalColumn(String AColumnTitle, DataColumn ADataColumn, int ADecimalDigits) { SourceGrid.Cells.Editors.TextBox DecimalEditor = new SourceGrid.Cells.Editors.TextBox(typeof(decimal)); DecimalEditor.TypeConverter = new Ict.Common.TypeConverter.TDecimalConverter( ADataColumn.ColumnName, Thread.CurrentThread.CurrentCulture.NumberFormat, ADecimalDigits); DecimalEditor.EditableMode = EditableMode.None; SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; AddTextColumn(AColumnTitle, ADataColumn, -1, null, DecimalEditor, null, view, null); }