Exemple #1
0
        public FrmNewZHZZT(FrmZhzzt mFrmZhzzt, string BID)
        {
            InitializeComponent();
            setcombox();
            //设置窗体属性
            LibCommon.FormDefaultPropertiesSetter.SetEnteringFormDefaultProperties(this, "修改柱状图");
            frmZhzzt = mFrmZhzzt;
            bid      = BID;
            isadd    = false;

            IQueryFilter pFilter = new QueryFilterClass();

            pFilter.WhereClause = "BID='" + BID + "' and strtype='1'";
            IFeatureCursor pCursor  = mFrmZhzzt.pFeatureClass.Search(pFilter, false);
            IFeature       pFeature = pCursor.NextFeature();

            if (pFeature != null)
            {
                string textstr = pFeature.get_Value(pFeature.Fields.FindField("textstr")).ToString();
                string bilici  = pFeature.get_Value(pFeature.Fields.FindField("bilici")).ToString();
                txtname.Text = textstr;
                txtBlc.Text  = bilici;
            }
            pFilter             = new QueryFilterClass();
            pFilter.WhereClause = "BID='" + BID + "' and xuhaoR>0";
            int count = mFrmZhzzt.pFeatureClass.FeatureCount(pFilter);

            count = count / 6;
            if (count % 6 != 0)
            {
                count += 1;
            }
            if (count == 0)
            {
                return;
            }
            dgrdvZhzzt.RowCount = count;
            for (int i = 0; i < count; i++)
            {
                pCursor  = MyMapHelp.FeatureSorting(mFrmZhzzt.pFeatureClass, "BID='" + BID + "' and xuhaoR=" + (i + 1) + "", "order by xuhaoC");
                pFeature = pCursor.NextFeature();
                while (pFeature != null)
                {
                    string textstr = "";
                    if (pFeature.get_Value(pFeature.Fields.FindField("textstr")) != null)
                    {
                        textstr = pFeature.get_Value(pFeature.Fields.FindField("textstr")).ToString();
                    }
                    string xuhaoC = pFeature.get_Value(pFeature.Fields.FindField("xuhaoC")).ToString();
                    if (xuhaoC.Equals("2"))
                    {
                        dgrdvZhzzt[0, i].Value = textstr;
                    }
                    if (xuhaoC.Equals("3"))
                    {
                        dgrdvZhzzt[1, i].Value = textstr;
                    }
                    if (xuhaoC.Equals("5"))
                    {
                        string zztype = pFeature.get_Value(pFeature.Fields.FindField("zztype")).ToString();
                        dgrdvZhzzt[2, i].Value = ZZCodeToStr(zztype);
                    }
                    if (xuhaoC.Equals("6"))
                    {
                        dgrdvZhzzt[3, i].Value = textstr;
                    }
                    pFeature = pCursor.NextFeature();
                }
            }
        }