/// <summary> /// 加入到图片队列 /// </summary> public void PushImages(Image img, string imgPath, string imgType) { var detailW = this.detailPic.Size.Width; var detailH = this.detailPic.Size.Height; //构建Pic容器 var x = 90; var y = 3; var marginY = 170; var tag = 0; //获取最后一个Pic var lastPic = this.PicList.LastOrDefault(); if (lastPic != null) { x = lastPic.Location.X; y = lastPic.Location.Y + marginY; tag = Convert.ToInt16(lastPic.Tag) + 1; } PictureBox pic = new PictureBox(); pic.Location = new System.Drawing.Point(x, y); pic.Name = "pic" + tag; pic.Tag = tag; pic.Size = new System.Drawing.Size(width, height); pic.TabIndex = 0; pic.TabStop = false; pic.Cursor = Cursors.Hand; pic.Click += picPicBox_Click; pic.Paint += picPicBox_Paint; var imgParam = new ImageEditParam { YuanImg = img, SuoImg = ImageUtil.CreateThumbnailImage(img, width, height), DetailImg = ImageUtil.CreateThumbnailImage(img, detailW, detailH), ImagePath = imgPath, ImageType = imgType, ScreenshotImg = img }; pic.Image = imgParam.SuoImg; this.PicList.Add(pic); this.Images.Add(imgParam); //添加缩略图 if (this.picPanel.InvokeRequired) { ThreadMethood t = () => { this.picPanel.Controls.Add(pic); }; this.picPanel.Invoke(t); this.SetDetailImg(); } else { this.picPanel.Controls.Add(pic); this.SetDetailImg(); } }
/// <summary> /// 编辑按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editBtn_Click(object sender, EventArgs e) { if (!this.CheckImg(FormConfigUtil.EditPicListCount)) { return; } var list = new List <ImageDetail>(); this.SelPicNames.ForEach(x => { var pic = this.PicList.Find(y => y.Name == x); if (pic != null) { //获取图片框保存的图片 var img = pic.Image; //获取对应的图片所有资源 var image = this.Images.Find(z => z.SuoImg == img); //保存原图 list.Add(new ImageDetail { Image = image.YuanImg, Path = image.ImagePath, Type = image.ImageType }); } }); //配置图片参数,提交给子窗体 var printParam = new ImageEditRequest { Images = list, PaperSize = this.PaperSize, PrintSize = this.PrintSize, SaveImgPath = FormConfigUtil.LocationPath }; EditFormFactory.ShowEditForm(printParam, img => { var imageEditList = new List <ImageEditParam>(); var imageEdit1 = new ImageEditParam { YuanImg = img, ScreenshotImg = img }; imageEditList.Add(imageEdit1); var printForm = new PrintForm(imageEditList, this.PaperSize); printForm.ShowDialog(); }); }
/// <summary> /// 打印 /// </summary> private void printBtn_Click(object sender, EventArgs e) { var list = new List <ImageEditParam>(); this.SelPicNames.ForEach(x => { var pic = this.PicList.Find(y => y.Name == x); var imgParam = this.Images.Find(z => z.SuoImg == pic.Image); var imageEdit = new ImageEditParam { YuanImg = imgParam.YuanImg, ScreenshotImg = imgParam.ScreenshotImg, ImagePath = imgParam.ImagePath, ImageType = imgParam.ImageType }; list.Add(imageEdit); }); var printForm = new PrintForm(list, "A3"); printForm.ShowDialog(); }
/// <summary> /// 打印按钮 /// </summary> private void printBtn_Click(object sender, EventArgs e) { if (!this.CheckImg(FormConfigUtil.PrintPicListCount)) { return; } var list = new List <ImageEditParam>(); this.SelPicNames.ForEach(x => { var pic = this.PicList.Find(y => y.Name == x); var imgParam = this.Images.Find(z => z.SuoImg == pic.Image); var imageEdit = new ImageEditParam { YuanImg = imgParam.YuanImg, ScreenshotImg = imgParam.YuanImg, ImagePath = imgParam.ImagePath, ImageType = imgParam.ImageType }; list.Add(imageEdit); }); var printForm = new PrintForm(list, this.PaperSize); printForm.ShowDialog(); }