Пример #1
0
        public void InitContorl()
        {
            int MaxWordWidth = CalcWidth();
            int currentPosY = 10;
            int currentPosX = 10;
            int index = 0;
            if (MaxWordWidth < 300)
            {
                MaxWordWidth = 300;
            }
            if (parentTemple != null && templeList!=null)
            {
                foreach (LP_Temple lp in templeList)
                {
                    bool flag;//= (lp.Status == CurrRecord.Status);
                    flag = true;
                    Label label = new Label();
                    label.Text = lp.CellName;
                    //string[] location = lp.CtrlLocation.Split(',');
                    string[] size = lp.CtrlSize.Split(',');
                    label.Location = new Point(currentPosX, currentPosY);
                    label.Size = new Size(MaxWordWidth, 14);
                    label.Visible = flag;
                    if (flag)
                    {
                        currentPosY += 20;
                    }
                    Control ctrl;

                    if (lp.CtrlType.Contains("uc_gridcontrol"))
                    {
                        ctrl = new uc_gridcontrol();
                        ((uc_gridcontrol)ctrl).CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridView1_CellValueChanged);
                    }
                    else
                        ctrl = (Control)Activator.CreateInstance(Type.GetType(lp.CtrlType));
                    ctrl.Location = new Point(currentPosX, currentPosY);
                    ctrl.Size = new Size(int.Parse(size[0]), int.Parse(size[1]));
                    if (flag)
                    {
                        currentPosY += int.Parse(size[1]) + 10;
                    }

                   
                    ctrl.TextChanged += new EventHandler(ctrl_Leave);
                    ctrl.Enter += new EventHandler(ctrl_Enter);
                    ctrl.Leave += new EventHandler(ctrl_Leave);
                    ctrl.Visible = flag;
                    ctrl.Tag = lp;
                    ctrl.TabIndex = index;
                    if (lp.CtrlType.Contains("uc_gridcontrol"))
                    {
                        (ctrl as uc_gridcontrol).InitCol(lp.ColumnName.Split(pchar),lp);
                    }
                    index++;
                    ctrl.Name = lp.LPID;
                    dockPanel1.Controls.Add(label);
                    dockPanel1.Controls.Add(ctrl);
                    if (lp.CellName == "编号")
                    {
                        ctrlNumber = ctrl;
                    }
                }
            }
            //InitEvent();
            InitData();
            if (RecordWorkTask.HaveRunSPYJRole(kind))
            {
                if (hqyjcontrol == null) hqyjcontrol = new SPYJControl();
                hqyjcontrol.Size = new System.Drawing.Size(400, 200);
                hqyjcontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10);
                currentPosY = currentPosY + hqyjcontrol.Size.Height;
                hqyjcontrol.RecordID = CurrRecord.ID;
                dockPanel1.Controls.Add(hqyjcontrol);
            }

            if (RecordWorkTask.HaveRunFuJianRole(kind))
            {
                
                if (filecontrol==null) filecontrol = new DownFileControl();
                if(status=="add")
                filecontrol.FormType = "上传";
                else if (status == "edit")
                {
                    filecontrol.FormType = "下载";
                }
                filecontrol.Size = new System.Drawing.Size(400, 200);
                filecontrol.Location = new System.Drawing.Point(currentPosX, currentPosY + 10);
                currentPosY = currentPosY + filecontrol.Size.Height;
                filecontrol.UpfilePath = GetWorkFlowNmae(kind);
                if (currRecord==null)
                {
                    currRecord = new LP_Record();
                }
                filecontrol.RecordID = CurrRecord.ID;
                dockPanel1.Controls.Add(filecontrol);
                currentPosY += 20;
            }
            if (currRecord.Status!="存档"||(WorkFlowData!=null&& RecordWorkTask.HaveWorkFlowBackRole(WorkFlowData.Rows[0]["WorkTaskId"].ToString(), WorkFlowData.Rows[0]["WorkFlowId"].ToString())))
            {
                Button btn_Back = new Button();
                dockPanel1.Controls.Add(btn_Back);
                btn_Back.Click += new EventHandler(btn_Back_Click);
                btn_Back.Location = new Point(currentPosX + 80, currentPosY + 10);
                btn_Back.Text = "退回";
            }
            Button btn_Submit = new Button();
            dockPanel1.Controls.Add(btn_Submit);
            btn_Submit.Location = new Point(currentPosX, currentPosY + 10);
            btn_Submit.Text = "关闭";
            btn_Submit.Click += new EventHandler(btn_Close);
            if (dockPanel1.ControlContainer.Controls.Count > 0)
                dockPanel1.ControlContainer.Controls[0].Focus();
        }
Пример #2
0
 public void InitContorl()
 {
     int MaxWordWidth = CalcWidth();
     int currentPosY = 10;
     int currentPosX = 10;
     int index = 0;
     foreach (LP_Temple lp in templeList)
     {
         Label label = new Label();
         label.Text = lp.CellName;
         //string[] location = lp.CtrlLocation.Split(',');
         string[] size = lp.CtrlSize.Split(',');
         label.Location = new Point(currentPosX, currentPosY);
         label.Size = new Size(MaxWordWidth, 14);
         currentPosY += 20;
         Control ctrl ;
         if (lp.CtrlType.Contains("uc_gridcontrol"))
             ctrl = new uc_gridcontrol();
         else
             ctrl = (Control)Activator.CreateInstance(Type.GetType(lp.CtrlType));
         ctrl.Location = new Point(currentPosX, currentPosY);
         ctrl.Size = new Size(int.Parse(size[0]), int.Parse(size[1]));
         currentPosY += int.Parse(size[1]) + 10; 
         ctrl.Leave += new EventHandler(ctrl_Leave);
         ctrl.Tag = lp;
         ctrl.TabIndex = index;
         if (lp.CtrlType.Contains("uc_gridcontrol"))
         {
             (ctrl as uc_gridcontrol).InitCol(lp.ColumnName.Split(pchar),lp);
         }
         index++;
         ctrl.Name = lp.LPID;
         dockPanel1.Controls.Add(label);
         dockPanel1.Controls.Add(ctrl);
     }
     InitEvent();
     InitData();
     Button btn_Submit = new Button();
     dockPanel1.Controls.Add(btn_Submit);
     btn_Submit.Location = new Point(currentPosX, currentPosY + 10);
     btn_Submit.Text = "提交";
     btn_Submit.Click += new EventHandler(btn_Submit_Click);
     if (dockPanel1.ControlContainer.Controls.Count > 0)
         dockPanel1.ControlContainer.Controls[0].Focus();
 }