コード例 #1
0
ファイル: InputGridBase.cs プロジェクト: ZhuSanfeng/SanfCode
        public InputGridBase()
            : base()
        {
            SSIT.PropertyBase.Resources res = new SSIT.PropertyBase.Resources();
            eNum = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(string));
            eNum.Control.KeyDown         += new System.Windows.Forms.KeyEventHandler(Control_KeyDown);
            eNum.EditableMode             = res.editablemode;
            eNum.Control.ImeMode          = System.Windows.Forms.ImeMode.Off;
            eNumReadOnly                  = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(string));
            eNumReadOnly.Control.ReadOnly = true;
            eNumReadOnly.EditableMode     = EditableMode.None;

            eLogic = res.EncodeComboBox(new string[] { EncodeConst.RightMark, EncodeConst.WrongMark }, false);

            FixedColumns = FixedRows = 1;
            this.ImeMode = System.Windows.Forms.ImeMode.Off;
            if (Controller.FindController(typeof(UpdateRowController)) == null)
            {
                Controller.AddController(new UpdateRowController());
            }
        }
コード例 #2
0
ファイル: InputGridBase.cs プロジェクト: ZhuSanfeng/SanfCode
        public virtual void Init()
        {
            SourceGrid.Cells.Views.Cell v_Normal   = new SSIT.PropertyBase.Resources().V_Common;
            SourceGrid.Cells.Views.Cell v_ReadOnly = new SSIT.PropertyBase.Resources().V_Common;
            v_ReadOnly.BackColor = System.Drawing.SystemColors.Control;
            Redim(Fields.Count + FixedRows, HeaderCount + SampleCount + 2);
            this[0, 0] = new Cells.Header("序号");
            this[0, 1] = new Cells.Header("检验项目");
            this[0, 2] = new Cells.Header("项目类型");
            this[0, 3] = new Cells.Header("值类型");
            this[0, 4] = new Cells.Header("检验标准");
            this[0, 5] = new Cells.Header("合格率要求(%)");

            for (int i = 0; i < Fields.Count; i++)
            {
                int rowindex = i + FixedRows;
                this[rowindex, 1]     = new Cells.Header(Fields[i].FieldName);
                this[rowindex, 2]     = new Cells.Header(Fields[i].CheckType);
                this[rowindex, 3]     = new Cells.Header(ValueTypeClass.GetStringValue(Fields[i].ValueType));
                this[rowindex, 4]     = new Cells.Header(Fields[i].StandardStr);
                this[rowindex, 5]     = new Cells.Header(Fields[i].QualifyRate);
                this[rowindex, 0]     = new Cells.RowHeader(i + 1);
                this[rowindex, 0].Tag = Fields[i];
            }
            for (int i = 0; i < SampleCount; i++)
            {
                this[0, i + HeaderCount] = new Cells.ColumnHeader(string.Format("第 {0} 个样本", i + 1));
            }
            SSIT.PropertyBase.Resources res = new SSIT.PropertyBase.Resources();

            for (int j = 0; j < Fields.Count; j++)
            {
                if (Fields[j].ValueType == ValueTypeEnum.Selection)
                {
                    if (!string.IsNullOrWhiteSpace(Fields[j].StandardStr))
                    {
                        string[]      strs = Fields[j].StandardStr.Split(new char[] { '|', '|' });// SSITEncode.Common.STRING.Split(Fields[j].StandardStr, "||");
                        List <string> list = new List <string>();
                        if (strs != null)
                        {
                            foreach (string str in strs)
                            {
                                if (!string.IsNullOrWhiteSpace(str))
                                {
                                    list.Add(str);
                                }
                            }
                        }
                        eSelection = res.EncodeComboBox(list, false);
                    }
                    else
                    {
                        eSelection = res.EncodeComboBox(new string[] { string.Empty }, false);
                    }
                }
                for (int i = HeaderCount; i < SampleCount + HeaderCount; i++)
                {
                    Cells.Cell cell = new SourceGrid.Cells.Cell();

                    if (!Fields[j].ReadOnly)
                    {
                        switch (Fields[j].ValueType)
                        {
                        case ValueTypeEnum.Logic:
                            cell.Editor = eLogic;
                            break;

                        case ValueTypeEnum.Number:
                            cell.Editor = eNum;
                            break;

                        case ValueTypeEnum.Selection:
                            cell.Editor = eSelection;
                            break;
                        }
                        //cell.View = v_Normal;
                    }
                    else
                    {
                        cell.Editor = eNumReadOnly;
                        // cell.View = v_ReadOnly;
                    }
                    cell.View = new SSIT.PropertyBase.Resources().V_Standard;
                    this[j + FixedRows, i] = cell;
                }
            }
            //合格率 合格判定
            this[0, HeaderCount + SampleCount]     = new Cells.Header("合格率(%)");
            this[0, HeaderCount + SampleCount + 1] = new Cells.Header("合格判定");
            for (int i = 0; i < Fields.Count; i++)
            {
                int rowindex = i + FixedRows;
                this[rowindex, HeaderCount + SampleCount]     = new Cells.Header();
                this[rowindex, HeaderCount + SampleCount + 1] = new Cells.Header();
            }
            this.Columns.AutoSize(true);

            this.Selection.SelectionMode = SourceGrid.GridSelectionMode.Cell;
        }