private void gridViewRowChanged1(object sender) { BaseFocusLabel.Focus(); ColumnView view = sender as ColumnView; ProcessGrid.SetFormValue(this, view); string GBCode = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, view.Columns["GBCode"])); byte[] pic = GetPic(GBCode); if (pic != null) { img1.Image = TemplatePic.ByteToImage(pic); } else { img1.Image = null; } GetItemLabel(GBCode); string sql = "SELECT JCTime,VendorAttn FROM UV1_Dev_GBJCLRDts WHERE GBCode=" + SysString.ToDBString(GBCode); sql += " ORDER BY JCTime DESC"; DataTable dt = SysUtils.Fill(sql); gridView2.GridControl.DataSource = dt; gridView2.GridControl.Show(); }
private void gridViewRowChanged2(object sender) { try { BaseFocusLabel.Focus(); ColumnView view = sender as ColumnView; if (view.FocusedRowHandle >= 0) { int ID = SysConvert.ToInt32(view.GetRowCellValue(view.FocusedRowHandle, "DtsID")); ItemGB entityGB = new ItemGB(); entityGB.ID = ID; entityGB.SelectByID(); List <Image> lstimage = new List <Image>(); if (entityGB.GBPic.Length > 10) { lstimage.Add(TemplatePic.ByteToImage(entityGB.GBPic)); } ucPictureView1.UCDataLstImage = lstimage; } else { List <Image> lstimage = new List <Image>(); ucPictureView1.UCDataLstImage = lstimage; } } catch (Exception E) { this.ShowMessage(E.Message); } }
/// <summary> /// ͼƬËõС /// </summary> private void btnPicSmaller_Click(object sender, EventArgs e) { try { if (pictureBoxStandPic.Image == null) { return; } if (saveStandImage == null) { saveStandImage = pictureBoxStandPic.Image; } decimal zoonNum = saveZoomNum * 0.1m + 1m; if (zoonNum <= 0) { return; } else { saveZoomNum--; } pictureBoxStandPic.Image = TemplatePic.ZoomImage(saveStandImage, zoonNum); } catch (Exception E) { this.ShowMessage(E.Message); } }
/// <summary> /// 压缩图片 /// </summary> public static Image ZipImage(Image p_Img) { Image img = p_Img; Bitmap bmp = new Bitmap(p_Img); string fn = TemplatePic.GetTempFileName("SP", "1"); bmp.Save(fn, System.Drawing.Imaging.ImageFormat.Jpeg); Image tempimg = Image.FromFile(fn); if (((byte[])ImageToByte(p_Img)).Length >= ((byte[])ImageToByte(tempimg)).Length)//确定变小了才替换 { img = tempimg; } return(img); }
private void BindPic() { ItemPic entity = new ItemPic(); entity.MainID = HTDataID; entity.Seq = 1; entity.SelectByID(); if (entity.PicImage != null) { pictureBox1.Image = TemplatePic.ByteToImage(entity.PicImage); } else { pictureBox1.Image = null; } }
/// <summary> /// 重新设置实体1 /// </summary> private void gridViewRowChanged1(object sender) { ColumnView view = sender as ColumnView; string itemCode = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, view.Columns["ItemCode"])); //SetStorgeQty(itemCode);//显示库存信息 if (SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ISN")) != "")//显示图片 { if (GetPicByCode(SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ISN"))) != null) { picSample.Image = TemplatePic.ByteToImage(GetPicByCode(SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, "ISN")))); } } }
private void BindPic() { string sql = "SELECT * FROM Data_VendorFile WHERE MainID=" + SysString.ToDBString(HTDataID); sql += " ORDER BY Seq"; DataTable dt = SysUtils.Fill(sql); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (SysConvert.ToInt32(dt.Rows[i]["FileTypeID"]) == i + 1) { switch (i + 1) { case 1: img1.Image = TemplatePic.ByteToImage((byte[])dt.Rows[i]["Context"]); txtRemark1.Text = SysConvert.ToString(dt.Rows[i]["Remark"]); break; case 2: img2.Image = TemplatePic.ByteToImage((byte[])dt.Rows[i]["Context"]); txtRemark2.Text = SysConvert.ToString(dt.Rows[i]["Remark"]); break; case 3: img3.Image = TemplatePic.ByteToImage((byte[])dt.Rows[i]["Context"]); txtRemark3.Text = SysConvert.ToString(dt.Rows[i]["Remark"]); break; case 4: img4.Image = TemplatePic.ByteToImage((byte[])dt.Rows[i]["Context"]); txtRemark4.Text = SysConvert.ToString(dt.Rows[i]["Remark"]); break; case 5: img5.Image = TemplatePic.ByteToImage((byte[])dt.Rows[i]["Context"]); txtRemark5.Text = SysConvert.ToString(dt.Rows[i]["Remark"]); break; default: break; } } } } }
private ItemPic[] GetItemPic() { ItemPic[] entity = new ItemPic[1]; for (int i = 0; i < 1; i++) { entity[i] = new ItemPic(); entity[i].MainID = HTDataID; entity[i].Seq = i + 1; entity[i].SelectByID(); if (i == 0) { entity[i].PicImage = TemplatePic.ImageToByte(pictureBox1.Image); } } return(entity); }
/// <summary> /// ÔʼͼƬ /// </summary> private void btnPicYuan_Click(object sender, EventArgs e) { try { if (pictureBoxStandPic.Image == null) { return; } if (saveStandImage == null) { saveStandImage = pictureBoxStandPic.Image; } saveZoomNum = 0; pictureBoxStandPic.Image = TemplatePic.ZoomImage(saveStandImage, saveZoomNum * 0.1m + 1m); } catch (Exception E) { this.ShowMessage(E.Message); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> private void gridViewRowChanged1(object sender) { BaseFocusLabel.Focus(); ColumnView view = sender as ColumnView; ProcessGrid.SetFormValue(this, view); int MainID = SysConvert.ToInt32(view.GetRowCellValue(view.FocusedRowHandle, view.Columns["MainID"])); string GBCode = SysConvert.ToString(view.GetRowCellValue(view.FocusedRowHandle, view.Columns["GBCode"])); byte[] pic = GetPic(GBCode); if (pic != null) { img1.Image = TemplatePic.ByteToImage(pic); } else { img1.Image = null; } BindGrid2(MainID); GetItemLabel(GBCode); }
private void EntitySet() { if (m_DID == 0) { Item entity = new Item(); entity.ID = m_ID; entity.SelectByID(); drpGBDate.DateTime = DateTime.Now.Date; txtGBItemName.Text = entity.ItemName; txtGMWeight.Text = entity.MWeight.ToString(); txtGMWidth.Text = entity.MWidth.ToString(); drpGBStatusID.EditValue = (int)EnumGBStatus.在库; txtGBCode_DoubleClick(null, null); } else { ItemGB entityGB = new ItemGB(); entityGB.ID = m_DID; entityGB.SelectByID(); drpGBDate.DateTime = entityGB.GBDate; List <Image> lstimage = new List <Image>(); if (entityGB.GBPic.Length > 10) { lstimage.Add(TemplatePic.ByteToImage(entityGB.GBPic)); ucPictureInput1.UCDataLstImage = lstimage; } txtGBCode.Text = entityGB.GBCode; txtColorNum.Text = entityGB.ColorNum; txtColorName.Text = entityGB.ColorName; txtDRemark.Text = entityGB.Remark; txtGBItemName.Text = entityGB.ItemName; txtGMWeight.Text = entityGB.MWeight.ToString(); txtGMWidth.Text = entityGB.MWidth.ToString(); drpGBStatusID.EditValue = entityGB.GBStatusID; } Common.BindGBColorNum(txtColorNum, m_ID, true); Common.BindGBColorName(txtColorName, m_ID, true); }
void BindImage() { string sql = "SELECT GBPic FROM Data_ItemGB WHERE ID=" + SysString.ToDBString(m_GBID); DataTable dt = SysUtils.Fill(sql); if (dt.Rows.Count > 0) { List <Image> lstimage = new List <Image>(); byte[] picdata = (byte[])dt.Rows[0][0]; if (picdata.Length > 10) { lstimage.Add(TemplatePic.ByteToImage(picdata)); } ucPictureView1.UCDataLstImage = lstimage; } else { List <Image> lstimage = new List <Image>(); ucPictureView1.UCDataLstImage = lstimage; } this.Text = "图片查看";//[" + GBCode + "]"; }
//private void btnPicNewBrowsing_Click(object sender, EventArgs e) //{ // try // { // if (m_ID == 0) // { // this.ShowMessage("请先保存数据"); // return; // } // openFileDialog1.Filter = "JPG文件(*.jpg)|*.jpg|GIF文件(*.gif)|*.gif|BMP文件(*.bmp)|*.bmp|全部文件(*.*)|*.*"; // if (this.openFileDialog1.ShowDialog() == DialogResult.OK) // { // string filenamerount = openFileDialog1.FileName; // img1.Image = Image.FromFile(filenamerount); // } // } // catch (Exception E) // { // this.ShowMessage(E.Message); // } //} private ItemGB GetItemGB() { ItemGB entity = new ItemGB(); entity.ID = m_DID; entity.SelectByID(); entity.MainID = m_ID; if (entity.Seq == 0) { entity.Seq = GetMaxSeq(m_ID); } entity.ColorName = txtColorName.Text.Trim(); entity.ColorNum = txtColorNum.Text.Trim(); entity.GBCode = txtGBCode.Text.Trim(); entity.XY = SysConvert.ToInt32(drpXY.EditValue); entity.GBStatusID = SysConvert.ToInt32(drpGBStatusID.EditValue); if (ucPictureInput1.UCDataLstImage.Count > 0) { entity.GBPic = TemplatePic.ImageToByte(ucPictureInput1.UCDataLstImage[0]); if (ucPictureInput1.UCDataLstSmallImage.Count > 0) { entity.GBPic2 = TemplatePic.ImageToByte(ucPictureInput1.UCDataLstSmallImage[0]); } } else { entity.GBPic = new byte[2]; entity.GBPic2 = new byte[2]; } entity.Remark = txtDRemark.Text.Trim(); entity.GBDate = drpGBDate.DateTime.Date; entity.MWidth = txtGMWidth.Text.Trim(); entity.MWeight = txtGMWeight.Text.Trim(); entity.ItemName = txtGBItemName.Text.Trim(); return(entity); }
private VendorFile GetSVendorFile() { VendorFile entity = new VendorFile(); int picNum = SysConvert.ToInt32(drpPicNum.EditValue); switch (picNum) { case 1: if (img1.Image != null) { entity.Context = TemplatePic.ImageToByte(img1.Image); entity.FileTypeID = picNum; entity.FileLength = SysConvert.ToDecimal(img1.Image.Width); entity.UploadOPID = FParamConfig.LoginID; entity.UploadTime = DateTime.Now.Date; entity.Remark = txtRemark1.Text.Trim(); } break; case 2: if (img2.Image != null) { entity.Context = TemplatePic.ImageToByte(img2.Image); entity.FileTypeID = picNum; entity.FileLength = SysConvert.ToDecimal(img2.Image.Width); entity.UploadOPID = FParamConfig.LoginID; entity.UploadTime = DateTime.Now.Date; entity.Remark = txtRemark2.Text.Trim(); } break; case 3: if (img3.Image != null) { entity.Context = TemplatePic.ImageToByte(img3.Image); entity.FileTypeID = picNum; entity.FileLength = SysConvert.ToDecimal(img3.Image.Width); entity.UploadOPID = FParamConfig.LoginID; entity.UploadTime = DateTime.Now.Date; entity.Remark = txtRemark3.Text.Trim(); } break; case 4: if (img4.Image != null) { entity.Context = TemplatePic.ImageToByte(img4.Image); entity.FileTypeID = picNum; entity.FileLength = SysConvert.ToDecimal(img4.Image.Width); entity.UploadOPID = FParamConfig.LoginID; entity.UploadTime = DateTime.Now.Date; entity.Remark = txtRemark4.Text.Trim(); } break; case 5: if (img5.Image != null) { entity.Context = TemplatePic.ImageToByte(img5.Image); entity.FileTypeID = picNum; entity.FileLength = SysConvert.ToDecimal(img5.Image.Width); entity.UploadOPID = FParamConfig.LoginID; entity.UploadTime = DateTime.Now.Date; entity.Remark = txtRemark5.Text.Trim(); } break; default: break; } return(entity); }
private VDsignerFile[] GetVDsignerFile() { int Num = 0; byte[] pic; for (int i = 1; i < 6; i++) { switch (i) { case 1: if (img1.Image != null) { Num++; } break; case 2: if (img2.Image != null) { Num++; } break; case 3: if (img3.Image != null) { Num++; } break; case 4: if (img4.Image != null) { Num++; } break; case 5: if (img5.Image != null) { Num++; } break; default: break; } } VDsignerFile[] entityDts = new VDsignerFile[Num]; int index = 0; for (int i = 1; i < 6; i++) { switch (i) { case 1: if (img1.Image != null) { entityDts[index] = new VDsignerFile(); entityDts[index].MainID = HTDataID; entityDts[index].Seq = i; entityDts[index].SelectByID(); entityDts[index].Context = TemplatePic.ImageToByte(img1.Image); entityDts[index].FileTypeID = i; entityDts[index].FileLength = SysConvert.ToDecimal(img1.Image.Width); entityDts[index].UploadOPID = FParamConfig.LoginID; entityDts[index].UploadTime = DateTime.Now.Date; index++; } break; case 2: if (img2.Image != null) { entityDts[index] = new VDsignerFile(); entityDts[index].MainID = HTDataID; entityDts[index].Seq = i; entityDts[index].SelectByID(); entityDts[index].Context = TemplatePic.ImageToByte(img2.Image); entityDts[index].FileTypeID = i; entityDts[index].FileLength = SysConvert.ToDecimal(img2.Image.Width); entityDts[index].UploadOPID = FParamConfig.LoginID; entityDts[index].UploadTime = DateTime.Now.Date; index++; } break; case 3: if (img3.Image != null) { entityDts[index] = new VDsignerFile(); entityDts[index].MainID = HTDataID; entityDts[index].Seq = i; entityDts[index].SelectByID(); entityDts[index].Context = TemplatePic.ImageToByte(img3.Image); entityDts[index].FileTypeID = i; entityDts[index].FileLength = SysConvert.ToDecimal(img3.Image.Width); entityDts[index].UploadOPID = FParamConfig.LoginID; entityDts[index].UploadTime = DateTime.Now.Date; index++; } break; case 4: if (img4.Image != null) { entityDts[index] = new VDsignerFile(); entityDts[index].MainID = HTDataID; entityDts[index].Seq = i; entityDts[index].SelectByID(); entityDts[index].Context = TemplatePic.ImageToByte(img4.Image); entityDts[index].FileTypeID = i; entityDts[index].FileLength = SysConvert.ToDecimal(img4.Image.Width); entityDts[index].UploadOPID = FParamConfig.LoginID; entityDts[index].UploadTime = DateTime.Now.Date; index++; } break; case 5: if (img5.Image != null) { entityDts[index] = new VDsignerFile(); entityDts[index].MainID = HTDataID; entityDts[index].Seq = i; entityDts[index].SelectByID(); entityDts[index].Context = TemplatePic.ImageToByte(img5.Image); entityDts[index].FileTypeID = i; entityDts[index].FileLength = SysConvert.ToDecimal(img5.Image.Width); entityDts[index].UploadOPID = FParamConfig.LoginID; entityDts[index].UploadTime = DateTime.Now.Date; index++; } break; default: break; } } return(entityDts); }