Пример #1
0
        addData(List <DataSet> varDataSet, string strOpt)
        {
            string strSource = "";

            switch (strOpt)
            {
            case "OnScreen":
                fExport.cmdObject.Text = "OBJECT";
                strSource = "SRT";

                break;

            case "ByRange":
                fExport.cmdObject.Text = "OBJECT";
                strSource = "SRT";

                break;

            case "ByAlign":
                fExport.cmdObject.Text = "ALIGNMENT";
                strSource = "SRT";
                break;

            case "SORT":
                switch (fExport.MODE)
                {
                case "OnScreen":
                case "ByRange":
                    fExport.cmdObject.Text = "OBJECT";
                    break;

                case "ByAlign":
                    fExport.cmdObject.Text = "ALIGNMENT";
                    break;
                }
                strSource = "SRT";
                break;

            case "SUM":
                switch (fExport.MODE)
                {
                case "OnScreen":
                case "ByRange":
                    fExport.cmdObject.Text = "OBJECT";
                    break;

                case "ByAlign":
                    fExport.cmdObject.Text = "ALIGNMENT";
                    break;
                }
                strSource = "SUM";
                break;
            }

            Form.ControlCollection cntrls = (Form.ControlCollection)fExport.fraPntDesc.Controls;
            int iCount = cntrls.Count;
            //initial count of controls on form

            Control  cntrl  = null;
            CheckBox chkBox = new CheckBox();
            Label    lbl    = new Label();
            TextBox  tBox   = new TextBox();
            Button   cmdBtn = new Button();

            for (int i = iCount - 1; i > -1; i--)
            {
                cntrl = cntrls[i];
                cntrls.Remove(cntrl);
            }

            for (int i = 0; i < varDataSet.Count; i++)
            {
                //1_________________________________________________________
                chkBox      = new CheckBox();
                chkBox.Name = string.Format("chkBoxA{0}", i);
                if (strOpt == "SUM")
                {
                    chkBox.Text = "VARIOUS";
                }
                else
                {
                    chkBox.Text = varDataSet[i].Layer;
                }
                cntrl        = chkBox;
                cntrl.Top    = 5 + i * 20;
                cntrl.Height = 18;
                cntrl.Left   = 5;

                cntrls.Add(cntrl);

                //2_________________________________________________________
                lbl      = new Label();
                lbl.Name = string.Format("lblObject{0}", i);
                if (strOpt == "SUM")
                {
                    lbl.Text = varDataSet[i].Name;
                }
                else
                {
                    lbl.Text = varDataSet[i].ObjectName;
                }
                lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                cntrl         = lbl;
                cntrl.Top     = 10 + i * 20;
                cntrl.Height  = 18;
                cntrl.Left    = 132;

                cntrls.Add(lbl);

                //3_________________________________________________________
                lbl           = new Label();
                lbl.Name      = string.Format("lblNumPnts{0}", i);
                lbl.Text      = varDataSet[i].COUNT.ToString();
                lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                cntrl         = lbl;
                cntrl.Top     = 10 + i * 20;
                cntrl.Height  = 18;
                cntrl.Width   = 48;
                cntrl.Left    = 222;

                cntrls.Add(lbl);

                //4_________________________________________________________
                lbl           = new Label();
                lbl.Name      = string.Format("lblLowerA{0}", i);
                lbl.Text      = varDataSet[i].Lower.ToString();
                lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                cntrl         = lbl;
                cntrl.Top     = 10 + i * 20;
                cntrl.Height  = 18;
                cntrl.Width   = 36;
                cntrl.Left    = 264;

                cntrls.Add(lbl);

                //5_________________________________________________________
                lbl           = new Label();
                lbl.Name      = string.Format("lblToA{0}", i);
                lbl.Text      = "TO";
                lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                cntrl         = lbl;
                cntrl.Top     = 10 + i * 20;
                cntrl.Height  = 18;
                cntrl.Width   = 18;
                cntrl.Left    = 288;

                cntrls.Add(lbl);

                //6_________________________________________________________
                lbl           = new Label();
                lbl.Name      = string.Format("lblUpperA{0}", i);
                lbl.Text      = varDataSet[i].Upper.ToString();
                lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                cntrl         = lbl;
                cntrl.Top     = 10 + i * 20;
                cntrl.Height  = 18;
                cntrl.Width   = 36;
                cntrl.Left    = 306;

                cntrls.Add(lbl);

                //7_________________________________________________________
                cmdBtn      = new Button();
                cmdBtn.Name = string.Format("cmdBox{0}", i);
                cmdBtn.Text = string.Format("LIST              {0} {1}", strSource, i);
                if (varDataSet[i].Missing)
                {
                    cmdBtn.BackColor = System.Drawing.Color.Red;
                }
                cntrl        = cmdBtn;
                cntrl.Top    = 6 + i * 20;
                cntrl.Height = 18;
                cntrl.Width  = 24;
                cntrl.Left   = 342;

                cntrls.Add(lbl);

                //8_________________________________________________________
                chkBox       = new CheckBox();
                chkBox.Name  = string.Format("chkBoxB{0}", i);
                cntrl        = chkBox;
                cntrl.Top    = 5 + i * 20;
                cntrl.Height = 18;
                cntrl.Left   = 390;

                cntrls.Add(cntrl);

                //9_________________________________________________________
                tBox         = new TextBox();
                tBox.Name    = string.Format("tbxLowerB{0}", i);
                cntrl        = tBox;
                cntrl.Top    = 5 + i * 20;
                cntrl.Height = 36;
                cntrl.Left   = 412;

                cntrls.Add(cntrl);

                //10_________________________________________________________
                lbl           = new Label();
                lbl.Name      = string.Format("lblToB{0}", i);
                lbl.Text      = "TO";
                lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                cntrl         = lbl;
                cntrl.Top     = 10 + i * 20;
                cntrl.Height  = 18;
                cntrl.Width   = 18;
                cntrl.Left    = 456;

                cntrls.Add(lbl);

                //11_________________________________________________________
                tBox         = new TextBox();
                tBox.Name    = string.Format("tbxUpperB{0}", i);
                cntrl        = tBox;
                cntrl.Top    = 5 + i * 20;
                cntrl.Height = 36;
                cntrl.Left   = 480;

                cntrls.Add(cntrl);
            }
        }
Пример #2
0
        updateForm(List <EW_Data> varData)
        {
            Form.ControlCollection       objCntrls = (ControlCollection)this.Controls;
            System.Windows.Forms.Control objCntrl;

            ObjectId idDictEW = Dict.getNamedDictionary("EARTHWORK", out exists);
            int      i        = 0;

            if (varData[0].ITERATION == "C")
            {
                for (int j = objCntrls.Count - 1; j >= 0; j--)
                {
                    objCntrl = objCntrls[j];
                    if (objCntrl.Name.Contains("lbl"))
                    {
                        objCntrls.RemoveAt(j);
                    }
                }

                int k = varData.Count;

                this.Note1.Top           = (50 + k * 25 + 50);
                this.Note2.Top           = (50 + k * 25 + 50 + 30);
                this.AdjustSurface.Top   = (50 + k * 25 + 20 + 30 + 30);
                this.tboxAdjSurface.Top  = (50 + k * 25 + 20 + 30 + 30);
                this.cmdOK.Top           = (50 + k * 25 + 20 + 30 + 30 + 30);
                this.cmdDone.Top         = (50 + k * 25 + 20 + 30 + 30 + 30);
                this.AdjustSurface2.Top  = (50 + k * 25 + 20 + 30 + 30 + 30 + 6);
                this.AdjustSurfaceSG.Top = (50 + k * 25 + 20 + 30 + 30 + 30);
                this.cmdOpenWS.Top       = (50 + k * 25 + 20 + 30 + 30 + 30);
                this.cmdClearHistory.Top = (50 + k * 25 + 20 + 30 + 30 + 30);
                this.Height = (50 + k * 25 + 20 + 30 + 30 + 90);
                i           = -1;
            }
            else
            {
                i = varData.Count;
            }

            Label objLabel = null;

            for (int j = 0; j < varData.Count; j++)
            {
                EW_Data vData = varData[i];
                i++;

                objLabel      = new Label();
                objLabel.Text = vData.ITERATION;                    //Iteration
                var _with1 = objLabel;
                _with1.Top    = (36 + i * 20);
                _with1.Left   = (24);
                _with1.Height = (12);
                _with1.Width  = (48);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = vData.DATE;                         // Date
                var _with2 = objLabel;
                _with2.Top    = (36 + i * 20);
                _with2.Left   = (78);
                _with2.Height = (12);
                _with2.Width  = (60);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = vData.USER;                         //User
                var _with3 = objLabel;
                _with3.Top    = (36 + i * 20);
                _with3.Left   = (142);
                _with3.Height = (12);
                _with3.Width  = (48);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("#,###,###", vData.AREA_SITE);                 //Area
                var _with4 = objLabel;
                _with4.Top    = (36 + i * 20);
                _with4.Left   = (198);
                _with4.Height = (12);
                _with4.Width  = (60);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("###.00", vData.SG_MEAN_ELEV);                //SG Mean Elev
                var _with5 = objLabel;
                _with5.Top    = (36 + i * 20);
                _with5.Left   = (260);
                _with5.Height = (12);
                _with5.Width  = (48);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("###,###.00", vData.VOL_CUT_TOT);                 //Cut
                var _with6 = objLabel;
                _with6.Top    = (36 + i * 20);
                _with6.Left   = (320);
                _with6.Height = (12);
                _with6.Width  = (60);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("###,###.00", vData.VOL_CUT_ADJ_NET);                //AdjCut
                var _with7 = objLabel;
                _with7.Top    = (36 + i * 20);
                _with7.Left   = (394);
                _with7.Height = (12);
                _with7.Width  = (60);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("###,###.00", vData.VOL_CUT_SHRINK);                //Shrinkage
                var _with8 = objLabel;
                _with8.Top    = (36 + i * 20);
                _with8.Left   = (476);
                _with8.Height = (12);
                _with8.Width  = (60);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("###,###.00", vData.VOL_CUT_NET);                 //Net Cut
                var _with9 = objLabel;
                _with9.Top    = (36 + i * 20);
                _with9.Left   = (564);
                _with9.Height = (12);
                _with9.Width  = (60);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("###,###.00", vData.VOL_FILL_TOT);                // Fil
                var _with10 = objLabel;
                _with10.Top    = (36 + i * 20);
                _with10.Left   = (646);
                _with10.Height = (12);
                _with10.Width  = (60);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("###,###.00", vData.VOL_FILL_ADJ_NET);                //AdjFill
                var _with11 = objLabel;
                _with11.Top    = (36 + i * 20);
                _with11.Left   = (732);
                _with11.Height = (12);
                _with11.Width  = (48);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("###,###.00", vData.VOL_FILL_NET);                // Net Fill
                var _with12 = objLabel;
                _with12.Top    = (36 + i * 20);
                _with12.Left   = (806);
                _with12.Height = (12);
                _with12.Width  = (48);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("##,###.00", vData.VOL_NET);                     //Balance
                var _with13 = objLabel;
                _with13.Top    = (36 + i * 20);
                _with13.Left   = (900);
                _with13.Height = (12);
                _with13.Width  = (48);
                objCntrls.Add(objLabel);

                objLabel      = new Label();
                objLabel.Text = string.Format("{0:##,###.00", vData.SITE_ADJUST);                   //Adj
                var _with14 = objLabel;
                _with14.Top    = (36 + i * 20);
                _with14.Left   = (974);
                _with14.Height = (12);
                _with14.Width  = (24);
                objCntrls.Add(objLabel);
            }
        }