예제 #1
0
        public override SourceGrid.Cells.Cell MakeDataCell()
        {
            SourceGrid.Cells.Cell            textcell     = null;
            SourceGrid.Cells.Editors.TextBox sharededitor = null;

            var sharededitor1 = GetSharedEditor();

            if (sharededitor1 != null)
            {
                sharededitor = sharededitor1 as SourceGrid.Cells.Editors.TextBox;
                if (sharededitor1 == null)
                {
                    throw new Exception("Wrong shared editor type.");
                }
            }

            if (sharededitor != null)
            {
                textcell        = new SourceGrid.Cells.Cell(GetDefaultValue());
                textcell.Editor = sharededitor;
            }
            else
            {
                textcell = new SourceGrid.Cells.Cell(GetDefaultValue(), GetValueType());
                var editor = new SourceGrid.Cells.Editors.TextBox(GetValueType());
                textcell.Editor              = editor;
                editor.Control.Multiline     = true;
                editor.Control.WordWrap      = true;
                editor.Control.AcceptsReturn = true;
                editor.Control.ScrollBars    = System.Windows.Forms.ScrollBars.Vertical;

                var tc = GetMyTypeConverter();
                if (tc != null)
                {
                    textcell.Editor.TypeConverter = tc;
                }

                //if (CustomConversions)
                ValueMapping = new ValueMappingB(textcell.Editor, this);
            }

            textcell.RowSpan = RowSpan;
            textcell.View    = Grid.gridViewModel.dataCellMultiLineModel;


            return(textcell);
        }
예제 #2
0
        public override SourceGrid.Cells.Cell MakeDataCell()
        {
            SourceGrid.Cells.Cell            textcell     = null;
            SourceGrid.Cells.Editors.TextBox sharededitor = null;

            var sharededitor1 = GetSharedEditor();

            if (sharededitor1 != null)
            {
                sharededitor = sharededitor1 as SourceGrid.Cells.Editors.TextBox;
                if (sharededitor1 == null)
                {
                    throw new Exception("Wrong shared editor type.");
                }
            }

            if (sharededitor != null)
            {
                textcell = new SourceGrid.Cells.Cell(GetDefaultValue(), sharededitor);
            }
            else
            {
                var valuetype = GetValueType();
                textcell = new SourceGrid.Cells.Cell(GetDefaultValue(), valuetype);
                var tc = GetMyTypeConverter();
                if (tc != null)
                {
                    textcell.Editor.TypeConverter = tc;
                }
                textcell.Editor.AllowNull = AllowNull;
                if (ReadOnly)
                {
                    textcell.Editor.EditableMode = EditableMode.None;
                }

                //if (CustomConversions)
                ValueMapping = new ValueMappingB(textcell.Editor, this);

                /*
                 * var dted = textcell.Editor as SourceGrid.Cells.Editors.DateTimePicker;
                 * if (dted != null)
                 * {
                 *  dted.Control.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
                 *  dted.Control.CustomFormat = string.IsNullOrEmpty(FormatString) ? "dd.MM.yyyy" : FormatString;
                 * }*/
            }

            if (RowValueType == EMyGridRowValueType.String)
            {
                textcell.AddController(KlonsLIB.MySourceGrid.MyToolTipText.Default);
                textcell.Model.AddModel(new KlonsLIB.MySourceGrid.MyToolTipModel());
            }

            if (rowSpan > 1 && RowValueType == EMyGridRowValueType.String)
            {
                textcell.View = Grid.gridViewModel.dataCellMultiLineModel;
            }
            else if (TextAllign == ECellTextAllign.NotSet)
            {
                switch (RowValueType)
                {
                case EMyGridRowValueType.Single:
                case EMyGridRowValueType.Double:
                case EMyGridRowValueType.ShortInt:
                case EMyGridRowValueType.Integer:
                case EMyGridRowValueType.Decimal:
                    textcell.View = Grid.gridViewModel.dataCellModelAllignRight;
                    break;

                default:
                    textcell.View = Grid.gridViewModel.dataCellModel;
                    break;
                }
            }
            else if (TextAllign == ECellTextAllign.Left)
            {
                textcell.View = Grid.gridViewModel.dataCellModel;
            }
            else
            {
                textcell.View = Grid.gridViewModel.dataCellModelAllignRight;
            }

            return(textcell);
        }