Exemple #1
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService = null;

            if (null != context && null != context.Instance)
            {
                sectionClass pcc = context.Instance as sectionClass;
                if (null != pcc && null != pcc.SourceField)
                {
                    editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                    if (editorService != null)
                    {
                        FieldTreeViewData   sfAll = (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine()) as FieldTreeViewData;
                        RelationFieldChoose rfc   = new RelationFieldChoose(editorService);

                        rfc.strRField = pcc.BindingField;
                        List <PmsField> lp = new List <PmsField>();

                        List <SourceField> lpdb = pcc.SourceField.GetSubSourceField(sfAll);
                        foreach (SourceField pdb in lpdb)
                        {
                            try
                            {
                                if (!string.IsNullOrEmpty(pdb.DataType))
                                {
                                    string typ = pdb.DataType.ToUpper();
                                    if (typ.Equals("INT", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("FLOAT", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("REAL", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("INT32", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("INT16", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("INT64", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("SYSTEM.SINGLE", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("SYSTEM.DOUBLE", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("SYSTEM.INT32", StringComparison.InvariantCultureIgnoreCase) ||
                                        typ.Equals("SYSTEM.DECIMAL", StringComparison.InvariantCultureIgnoreCase))
                                    {
                                        PmsField pf = new PmsField();
                                        pf.fieldName        = pdb.RecordField;
                                        pf.fieldDescription = pdb.Name;
                                        lp.Add(pf);
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                        rfc.pmsFieldList = lp;
                        editorService.DropDownControl(rfc);
                        if (!string.IsNullOrEmpty(rfc.strRField))
                        {
                            value = rfc.strRField;
                        }
                        return(value);
                    }
                }
            }
            return(base.EditValue(context, provider, value));
        }
        SectionSeries setSectionSeries(backSeries ps, sectionClass scX, sectionClassY scY, Section sec)
        {
            SectionSeries ss = new SectionSeries(ps.ToSeries());

            ss.SectionChartType    = ps.SectionChartType;
            ss.Distance            = sec.Distance;
            ss.TimeType            = sec.TimeType;
            ss.PointsCount         = sec.PointsCount;
            ss.SectionField        = scX.BindingField;
            ss.LabelStyle          = scX.LabelStyle;
            ss.Format              = scX.Format;
            ss.BindingField        = sec.BindingField;
            ss.AxisMum.Enable      = scY.AutoScale;
            ss.AxisMum.YaxisMaxmum = scY.Max;
            ss.AxisMum.YaxisMinmum = scY.Min;
            return(ss);
        }
        /// <summary>
        /// 初始化X轴,Y轴,分段信息
        /// </summary>
        /// <param name="ps"></param>
        /// <param name="scX"></param>
        /// <param name="scY"></param>
        /// <param name="sec"></param>
        /// <returns>分段曲线信息</returns>
        backSeries getSectionInfo(PMSSeries ps, sectionClass scX, sectionClassY scY, Section sec)
        {
            backSeries bs = new backSeries(ps.ToSeries());

            bs.SectionChartType = (ps as SectionSeries).SectionChartType;;
            sec.Distance        = (ps as SectionSeries).Distance;
            sec.TimeType        = (ps as SectionSeries).TimeType;
            sec.PointsCount     = (ps as SectionSeries).PointsCount;
            scX.BindingField    = (ps as SectionSeries).SectionField;
            scX.SourceField     = (ps as SectionSeries).SourceField;
            scX.LabelStyle      = (ps as SectionSeries).LabelStyle;
            scX.Format          = (ps as SectionSeries).Format;
            sec.BindingField    = (ps as SectionSeries).BindingField;
            if ((ps as SectionSeries).AxisMum != null)
            {
                scY.AutoScale = (ps as SectionSeries).AxisMum.Enable;
                scY.Max       = (ps as SectionSeries).AxisMum.YaxisMaxmum;
                scY.Min       = (ps as SectionSeries).AxisMum.YaxisMinmum;
            }
            return(bs);
        }