private void btn_scale_Click(object sender, EventArgs e)
        {
            try
            {
                var scaleRate = Convert.ToDouble(txb_scaleRate.Text);

                if (!firstChoise)
                {
                    pbox_edited.Image = pbox_original.Image;

                    firstChoise = true;
                }

                ImageEdit.imageStack.Push(pbox_edited.Image);
                ImageEdit.editedImage = pbox_edited.Image;

                pbox_edited.Image      = ImageEdit.Scale(pbox_edited.Image, scaleRate);
                pbox_edited.SizeMode   = PictureBoxSizeMode.CenterImage;
                pbox_original.SizeMode = PictureBoxSizeMode.CenterImage;
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Пример #2
0
        private void BlurButton_Click(object sender, EventArgs e)
        {
            image = new ImageEdit(openFileDialog.FileName);
            editedImageBox.Image = image.CreateBlurredImage();

            saveButton.Enabled = true;
        }
Пример #3
0
        public IActionResult Delete(Guid id)
        {
            ImageEdit model = new ImageEdit();

            model.ImageId = id;
            try
            {
                FindByIDQuery query = new FindByIDQuery();
                query.ImageId = id;
                this.service.FindByID(query);
                if (query.Response == FindByIDQuery.SUCCESS)
                {
                    model.ImageDisplay = String.Format("data:image/gif;base64,{0}", Convert.ToBase64String(query.Record.Image));
                    model.ImageAlt     = query.Record.ImageAlt;
                    model.ImageName    = query.Record.ImageName;
                    model.ImageUrl     = query.Record.ImageUrl;

                    query.Record.ImageTags.Sort((t1, t2) => string.Compare(t1.Name, t2.Name));

                    model.TagIDs   = query.Record.ImageTags.Select(t => t.ImageTagId).ToArray();
                    model.TagNames = query.Record.ImageTags.Select(t => t.Name).ToArray();
                }
                else
                {
                    throw new ArgumentException(EventMessage.ERROR, "Business Logic Error");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(View(model));
        }
Пример #4
0
        public void TestThatImage_IsNegative()
        {
            Bitmap    originalImage = new Bitmap(3, 3);
            ImageEdit image         = new ImageEdit(originalImage);

            for (int x = 0; x < originalImage.Height; x++)
            {
                for (int y = 0; y < originalImage.Width; y++)
                {
                    originalImage.SetPixel(x, y, Color.FromArgb(150, 200, 250));
                }
            }


            Bitmap negativeImage = image.CreateNegativeImage();

            for (int x = 0; x < negativeImage.Height; x++)
            {
                for (int y = 0; y < negativeImage.Width; y++)
                {
                    Color negativePixelColor = negativeImage.GetPixel(x, y);
                    Assert.AreEqual(105, negativePixelColor.R);
                    Assert.AreEqual(55, negativePixelColor.G);
                    Assert.AreEqual(5, negativePixelColor.B);
                }
            }
        }
Пример #5
0
 void controlClear( )
 {
     foreach (Control ct in layoutControl1.Controls)
     {
         if (ct.GetType( ) == typeof(TextEdit))
         {
             TextEdit td = ct as TextEdit;
             td.Text = string.Empty;
         }
         if (ct.GetType( ) == typeof(DateEdit))
         {
             DateEdit td = ct as DateEdit;
             td.Text = string.Empty;
         }
         if (ct.GetType( ) == typeof(ImageEdit))
         {
             ImageEdit td = ct as ImageEdit;
             td.Image = null;
         }
         if (ct.GetType( ) == typeof(GridLookUpEdit))
         {
             GridLookUpEdit gl = ct as GridLookUpEdit;
             gl.EditValue = null;
         }
     }
     gridControl1.DataSource = null;
 }
Пример #6
0
        public void TestThatImage_IsBlurred()
        {
            Bitmap    originalImage = new Bitmap(9, 9);
            ImageEdit imageEdit     = new ImageEdit(originalImage);

            for (int x = 0; x < originalImage.Height; x++)
            {
                for (int y = 0; y < originalImage.Width; y++)
                {
                    originalImage.SetPixel(x, y, Color.FromArgb(250, 250, 250));
                }
            }

            originalImage.SetPixel(4, 4, Color.FromArgb(100, 100, 100));

            Bitmap blurredImage = imageEdit.CreateBlurredImage();

            for (int x = 2; x < blurredImage.Height - 2; x++)
            {
                for (int y = 2; y < blurredImage.Width - 2; y++)
                {
                    Color blurredPixel = blurredImage.GetPixel(x, y);
                    Assert.AreEqual(244, blurredPixel.R);
                    Assert.AreEqual(244, blurredPixel.G);
                    Assert.AreEqual(244, blurredPixel.B);
                }
            }
        }
Пример #7
0
        public void TestThatImage_IsGreyscale()
        {
            Bitmap    originalImage = new Bitmap(3, 3);
            ImageEdit imageEdit     = new ImageEdit(originalImage);

            for (int x = 0; x < originalImage.Height; x++)
            {
                for (int y = 0; y < originalImage.Width; y++)
                {
                    originalImage.SetPixel(x, y, Color.FromArgb(150, 200, 250));
                }
            }

            Bitmap greyscaleImage = imageEdit.CreateGrayscaleImage();

            for (int x = 0; x < greyscaleImage.Height; x++)
            {
                for (int y = 0; y < greyscaleImage.Width; y++)
                {
                    Color greyscalePixel = greyscaleImage.GetPixel(x, y);

                    Assert.AreEqual(200, greyscalePixel.R);
                    Assert.AreEqual(200, greyscalePixel.G);
                    Assert.AreEqual(200, greyscalePixel.B);
                }
            }
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     _thumbnail    = new ImageEdit();
     this.pnlMain  = new System.Windows.Forms.Panel();
     this.pnlInner = new System.Windows.Forms.Panel();
     this.pctMain  = new System.Windows.Forms.PictureBox();
     this.pnlMain.SuspendLayout();
     this.pnlInner.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.pctMain)).BeginInit();
     this.SuspendLayout();
     //
     // pnlMain
     //
     this.pnlMain.AutoScroll = true;
     this.pnlMain.BackColor  = System.Drawing.SystemColors.ControlDark;
     this.pnlMain.Controls.Add(this.pnlInner);
     this.pnlMain.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.pnlMain.Location = new System.Drawing.Point(0, 0);
     this.pnlMain.Name     = "pnlMain";
     this.pnlMain.Size     = new System.Drawing.Size(300, 300);
     this.pnlMain.TabIndex = 1;
     this.pnlMain.Resize  += new System.EventHandler(this.pnlMain_Resize);
     //
     // pnlInner
     //
     this.pnlInner.AutoScroll = true;
     this.pnlInner.BackColor  = System.Drawing.SystemColors.ControlDark;
     this.pnlInner.Controls.Add(this.pctMain);
     this.pnlInner.Location = new System.Drawing.Point(0, 0);
     this.pnlInner.Name     = "pnlInner";
     this.pnlInner.Size     = new System.Drawing.Size(300, 300);
     this.pnlInner.TabIndex = 0;
     //
     // pctMain
     //
     this.pctMain.BackColor   = System.Drawing.SystemColors.Control;
     this.pctMain.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.pctMain.Dock        = System.Windows.Forms.DockStyle.Fill;
     this.pctMain.Location    = new System.Drawing.Point(0, 0);
     this.pctMain.Name        = "pctMain";
     this.pctMain.Size        = new System.Drawing.Size(300, 300);
     this.pctMain.SizeMode    = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
     this.pctMain.TabIndex    = 0;
     this.pctMain.TabStop     = false;
     //
     // ThumbnailControl
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.Controls.Add(this.pnlMain);
     this.Name = "ThumbnailControl";
     this.Size = new System.Drawing.Size(300, 300);
     this.pnlMain.ResumeLayout(false);
     this.pnlInner.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.pctMain)).EndInit();
     this.ResumeLayout(false);
 }
Пример #9
0
        public ActionResult Edit(int id)
        {
            IImageDAC dac   = new ImageDAC();
            var       image = dac.GetImage(id);
            var       model = new ImageEdit {
                Filename = image.Filename, GalleryID = image.GalleryID, Title = image.Title, ImageID = image.ImageID
            };

            return(View(model));
        }
Пример #10
0
        public IActionResult Edit(ImageEdit model)
        {
            EditImageCommand command = new EditImageCommand();

            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            try
            {
                command.image = new AlbumImage {
                    ImageAlt = model.ImageAlt, ImageName = model.ImageName, ImageUrl = model.ImageUrl, ImageId = model.ImageId
                };

                //each tag should have a corrisponding tag name but just incase lets check
                if (model.TagIDs != null && model.TagIDs.Length > 0 && model.TagNames != null && model.TagNames.Length > 0)
                {
                    if (model.TagNames.Length == model.TagIDs.Length)
                    {
                        command.image.ImageTags = new List <AlbumImageTag>();
                        for (int i = 0; i < model.TagIDs.Length; i++)
                        {
                            command.image.ImageTags.Add(new AlbumImageTag {
                                ImageId = model.ImageId, ImageTagId = model.TagIDs[i], Name = model.TagNames[i]
                            });
                        }
                    }
                    else
                    {
                        throw new ArgumentException("Tag Name and Tag Ids don't have the same amount");
                    }
                }

                if (model.ImageFile != null && model.ImageFile.Length > 0)
                {
                    using (var ms = new MemoryStream())
                    {
                        model.ImageFile.CopyTo(ms);
                        command.image.Image = ms.ToArray();
                    }
                }
                this.service.Update(command);

                if (command.Response != EditImageCommand.SUCCESS)
                {
                    throw new ArgumentException(EditImageCommand.ERROR, "Business Logic Error");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(RedirectToAction("Edit", new { id = model.ImageId, message = "Image Saved!" }));
        }
Пример #11
0
        public ActionResult Edit(ImageEdit image)
        {
            if (!ModelState.IsValid)
            {
                return(View(image));
            }
            IImageDAC dac = new ImageDAC();

            dac.Update(image.ImageID, image.Title, 1);
            return(RedirectToAction("Index", new { galleryID = image.GalleryID }));
        }
        private void btn_mirror_Click(object sender, EventArgs e)
        {
            if (!firstChoise)
            {
                pbox_edited.Image = pbox_original.Image;

                firstChoise = true;
            }

            ImageEdit.imageStack.Push(pbox_edited.Image);
            ImageEdit.editedImage = pbox_edited.Image;
            pbox_edited.Image     = ImageEdit.Mirror(pbox_edited.Image);
        }
Пример #13
0
        private void BtnChangePhoto_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Select a picture";
            openFileDialog.Filter = "Image files (*.bmp;*jpg*;.jpeg*;.png)|*.bmp;*jpg*;.jpeg*;.png|All files (*.*)|*.*";

            if (openFileDialog.ShowDialog() == true)
            {
                photoUser = ImageEdit.CreateBitmapImageUserSize(openFileDialog.FileName, 1000, 1000);
                if (photoUser != null)
                {
                    imgPhotoAndPicture.Source = photoUser;
                }
            }
        }
Пример #14
0
        private void imageEdit1_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
        {
            SaveFileDialog dlg    = new SaveFileDialog();
            ImageEdit      editor = (ImageEdit)sender;

            if (editor.Source != null && editor.Source is BitmapImage)
            {
                BitmapImage bi     = (BitmapImage)editor.Source;
                Stream      stream = bi.StreamSource as Stream;
                if (stream is FileStream)
                {
                    System.Windows.MessageBox.Show(((FileStream)stream).Name);
                }
                //if (stream != null)
                //    System.Windows.MessageBox.Show(stream.Name);
            }
        }
Пример #15
0
        //GET Edit
        public ActionResult Edit(int id)
        {
            var service = CreateImageService();
            var detail  = service.GetImageById(id);
            var model   =
                new ImageEdit
            {
                ImageID    = detail.ImageID,
                Title      = detail.Title,
                ImagePath  = detail.ImagePath,
                ImageFile  = detail.ImageFile,
                TopText    = detail.TopText,
                BottomText = detail.BottomText,
            };

            return(View(model));
        }
Пример #16
0
        public async Task <ActionResponse> UpdateImage([FromBody] ImageEdit imageRequest)
        {
            string userId = authenticationCurrentContext.CurrentUser;

            if (imageRequest.Image != null && imageRequest.Image.StartsWith("data:image/png;base64,"))
            {
                string path = await amazonS3ImageProvider.Add($"users/{userId}/profile.png", imageRequest.Image);

                imageRequest.Image = path;
            }

            bool updated = await userRepository.UpdateImage(userId, imageRequest.Image);

            return(new ActionResponse
            {
                State = updated
            });
        }
Пример #17
0
        private void BrowseButton_Click(object sender, EventArgs e)
        {
            openFileDialog.InitialDirectory = "C:" + Path.DirectorySeparatorChar;
            openFileDialog.Filter           = "jpeg (*.jpg)|*.jpg|png (*.png)|*.png) ";


            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                editedImageBox.Image = null;

                ImageEdit image = new ImageEdit(openFileDialog.FileName);
                originalImageBox.Image = image.Image;

                negativeButton.Enabled  = true;
                greyscaleButton.Enabled = true;
                blurButton.Enabled      = true;
            }
        }
Пример #18
0
        public bool UpdateImage(ImageEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Images
                    .Single(e => e.ImageID == model.ImageID && e.OwnerId == _userId);

                entity.Title      = model.Title;
                entity.ImagePath  = model.ImagePath;
                entity.ImageFile  = model.ImageFile;
                entity.TopText    = model.TopText;
                entity.BottomText = model.BottomText;

                return(ctx.SaveChanges() == 1);
            }
        }
Пример #19
0
        static void Main(string[] args)
        {
            string fileName = string.Empty;

            if (args.Length == 2)
            {
                fileName = args[1];
            }
            else if (args.Length == 1)
            {
                fileName = args[0];
            }
            else
            {
                Console.WriteLine("Enter a file path for an image: ");
                fileName = Console.ReadLine();
            }

            ImageEdit image = null;

            try
            {
                image = new ImageEdit(fileName);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid Format");
                Environment.Exit(1);
            }

            Bitmap blurredImage   = image.CreateBlurredImage();
            Bitmap greyscaleImage = image.CreateGrayscaleImage();
            Bitmap negativeImage  = image.CreateNegativeImage();

            image.SaveImage(blurredImage);
            image.SaveImage(greyscaleImage);
            image.SaveImage(negativeImage);
        }
Пример #20
0
        public ActionResult Edit(int id, ImageEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.ImageID != id)
            {
                ModelState.AddModelError("", "ID Mismatch");
                return(View(model));
            }

            var service = CreateImageService();

            if (service.UpdateImage(model))
            {
                TempData["SaveResult"] = "Your meme was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your meme could not be updated. The system requires that you make an edit to your Meme.");
            return(View(model));
        }
Пример #21
0
 public ImageEditLoadCommand(ImageEdit imageEdit) : base(imageEdit)
 {
 }
Пример #22
0
 private void ImgAdmib_Loaded(object sender, RoutedEventArgs e)
 {
     imgAdmin.Source = ImageEdit.CreateBitmapImage(System.IO.Path.Combine(Helper.GetPathToSolution(), "Images", "admin.png"));
 }
Пример #23
0
 private void ImgQuestionMark_Loaded(object sender, RoutedEventArgs e)
 {
     //string path = System.IO.Path.Combine(Environment.CurrentDirectory, "my_question_mark_icon.png");
     imgQuestionMark.Source = ImageEdit.CreateBitmapImage(System.IO.Path.Combine(Helper.GetPathToSolution(), "Images", "my_question_mark_icon.png"));
 }
Пример #24
0
 public ImageEditCommand(ImageEdit imageEdit)
 {
     ImageEdit = imageEdit;
 }
Пример #25
0
 public override void Execute(object parameter)
 {
     ImageEdit.Clear();
 }
Пример #26
0
 public static void SetImageEdit(DependencyObject d, ImageEdit value)
 {
     d.SetValue(ImageEditProperty, value);
 }
Пример #27
0
 public ImageEditClearCommand(ImageEdit imageEdit) : base(imageEdit)
 {
 }
Пример #28
0
        /// <summary>
        /// 创建自定义控件
        /// </summary>
        public void CreateDynamicControl()
        {
            if (DynamicMasterTableData.Select("bSystemColumn=0").Length > 0)
            {
                pnlDynamic.Visible = true;

                //每行控件数
                int iControlColumn = Convert.ToInt32(DynamicMasterTableData.Rows[0]["iControlColumn"]);
                //控件间距
                int iControlSpace = Convert.ToInt32(DynamicMasterTableData.Rows[0]["iControlSpace"]);
                //先计算需要生成控件的数据,去除如果在自定义字段权限设置中设置为不可见的数据
                List<DataRow> drs = DynamicMasterTableData.Select("bSystemColumn=0 AND bShowInPanel=1").ToList();

                if (!SecurityCenter.IsAdmin && FormFieldSetting.Rows.Count > 0)
                {
                    for (int i = 0; i < drs.Count; i++)
                    {
                        //取只有是主表/单表的数据
                        foreach (DataRow drField in FormFieldSetting.Select("sTableName='" + MasterTableName + "'"))
                        {
                            if (drs[i]["sFieldName"].ToString() == drField["sFieldName"].ToString() &&
                                !Convert.ToBoolean(drField["bVisiable"]))
                            {
                                drs.Remove(drs[i]);
                            }
                        }
                    }
                }

                //计算控件总共行数
                int iRows = 0;
                if (drs.Count > 0)
                {
                    if (drs.Count % iControlColumn != 0)
                    {
                        iRows = (int)Math.Floor(Convert.ToDecimal(drs.Count / iControlColumn)) + 1;
                    }
                    else
                    {
                        iRows = Convert.ToInt32(drs.Count / iControlColumn);
                    }
                    //设置控件数计数
                    int iControl = 0;
                    for (int j = 0; j < iRows; j++)
                    {
                        for (int i = 0; i < iControlColumn; i++)
                        {
                            //控件类型
                            string sControlType = drs[iControl]["sControlType"].ToString();
                            //创建控件
                            //Lable大小控制为80X21,其他输入控件大小为120X21
                            Label lblControl = new Label();
                            lblControl.AutoSize = false;
                            lblControl.Size = new Size(80, 21);
                            lblControl.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i, ControlY + (21 + 10) * j);
                            //控件命名规则:lbl+字段名
                            lblControl.Name = "lbl" + drs[iControl]["sFieldName"].ToString();
                            lblControl.TextAlign = ContentAlignment.BottomLeft;
                            //当控件类型为复选框\单选\Label标签时不创建Lable控件
                            if (sControlType != "chk" && sControlType != "rad" && sControlType != "lbl")
                            {
                                lblControl.Text = LangCenter.Instance.IsDefaultLanguage ? drs[iControl]["sCaption"].ToString() : drs[iControl]["sCaption"].ToString();
                            }
                            else
                                lblControl.Visible = false;
                            pnlDynamic.Controls.Add(lblControl);
                            switch (sControlType)
                            {
                                case "txt":
                                    {
                                        TextEdit txt = new TextEdit();
                                        txt.Size = new Size(120, 21);
                                        txt.Name = "txt" + drs[iControl]["sFieldName"].ToString();
                                        txt.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        pnlDynamic.Controls.Add(txt);
                                        break;
                                    }
                                case "mtxt":
                                    {
                                        MemoEdit mtxt = new MemoEdit();
                                        mtxt.Size = new Size(120, 21);
                                        mtxt.Name = "mtxt" + drs[iControl]["sFieldName"].ToString();
                                        mtxt.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        pnlDynamic.Controls.Add(mtxt);
                                        break;
                                    }
                                case "btxt":
                                    {
                                        MemoExEdit btxt = new MemoExEdit();
                                        btxt.Size = new Size(120, 21);
                                        btxt.Name = "btxt" + drs[iControl]["sFieldName"].ToString();
                                        btxt.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        pnlDynamic.Controls.Add(btxt);
                                        break;
                                    }
                                case "cbx":
                                    {
                                        ImageComboBoxEdit cbx = new ImageComboBoxEdit();
                                        cbx.Size = new Size(120, 21);
                                        cbx.Name = "cbx" + drs[iControl]["sFieldName"].ToString();
                                        cbx.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        pnlDynamic.Controls.Add(cbx);
                                        break;
                                    }
                                case "chk":
                                    {
                                        CheckEdit chk = new CheckEdit();
                                        chk.Size = new Size(120, 21);
                                        chk.Name = "chk" + drs[iControl]["sFieldName"].ToString();
                                        chk.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        chk.CheckState = CheckState.Unchecked;
                                        chk.Text = LangCenter.Instance.IsDefaultLanguage ? drs[iControl]["sCaption"].ToString() : drs[iControl]["sEngCaption"].ToString();
                                        pnlDynamic.Controls.Add(chk);
                                        break;
                                    }
                                case "det":
                                    {
                                        DateEdit det = new DateEdit();
                                        det.Size = new Size(120, 21);
                                        det.Name = "det" + drs[iControl]["sFieldName"].ToString();
                                        det.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        det.EditValue = null;
                                        pnlDynamic.Controls.Add(det);
                                        break;
                                    }
                                case "dett":
                                    {
                                        DateEdit dett = new DateEdit();
                                        dett.Size = new Size(120, 21);
                                        dett.Name = "dett" + drs[iControl]["sFieldName"].ToString();
                                        dett.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        dett.EditValue = null;
                                        dett.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
                                        dett.Properties.DisplayFormat.FormatString = "g";
                                        dett.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
                                        dett.Properties.EditFormat.FormatString = "g";
                                        dett.Properties.EditMask = "g";
                                        pnlDynamic.Controls.Add(dett);
                                        break;
                                    }
                                case "img":
                                    {
                                        ImageEdit img = new ImageEdit();
                                        img.Size = new Size(120, 21);
                                        img.Name = "img" + drs[iControl]["sFieldName"].ToString();
                                        img.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        pnlDynamic.Controls.Add(img);
                                        break;
                                    }
                                case "lbl":
                                    {
                                        LabelControl lbl = new LabelControl();
                                        lbl.Size = new Size(120, 21);
                                        lbl.Name = "lbl" + drs[iControl]["sFieldName"].ToString() + iControl.ToString();
                                        lbl.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        lbl.Text = LangCenter.Instance.IsDefaultLanguage ? drs[iControl]["sCaption"].ToString() : drs[iControl]["sEngCaption"].ToString();
                                        pnlDynamic.Controls.Add(lbl);
                                        break;
                                    }
                                case "lkp":
                                    {
                                        SunriseLookUp lkp = new SunriseLookUp();
                                        lkp.Size = new Size(120, 21);
                                        lkp.Name = "lkp" + drs[iControl]["sFieldName"].ToString();
                                        lkp.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        pnlDynamic.Controls.Add(lkp);
                                        break;
                                    }
                                case "mlkp":
                                    {
                                        SunriseMLookUp mlkp = new SunriseMLookUp();
                                        mlkp.Size = new Size(120, 21);
                                        mlkp.Name = "mlkp" + drs[iControl]["sFieldName"].ToString();
                                        mlkp.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        pnlDynamic.Controls.Add(mlkp);
                                        break;
                                    }
                                case "rad":
                                    {
                                        RadioGroup rad = new RadioGroup();
                                        rad.Size = new Size(120, 21);
                                        rad.Name = "rad" + drs[iControl]["sFieldName"].ToString();
                                        rad.Location = new Point(ControlX + (80 + 120 + iControlSpace) * i + 80, ControlY + 4 + (21 + 10) * j);
                                        pnlDynamic.Controls.Add(rad);
                                        break;
                                    }
                            }
                            iControl++;
                            //当计数大于等于要创建的控件数量时则退出循环
                            if (iControl >= drs.Count)
                                break;
                        }
                    }
                }
                pnlDynamic.Height = ControlY + iRows * 31;
            }
            //初始化数据绑定
            InitDataBindings();
        }