//Yj2015.0226 Add 双击通用名显示图片 --- void dataGridViewX1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGridViewX1.Columns["Column1"].Index) { int goodsPackageId = 0; int goodsId = 0; if (int.TryParse(dataGridViewX1.Rows[e.RowIndex].Cells["Product_ID"].Value.ToString(), out goodsPackageId) && int.TryParse(dataGridViewX1.Rows[e.RowIndex].Cells["Goods_Id"].Value.ToString(), out goodsId)) { soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); string imgUrl = bll.GetImageUrl(goodsId, goodsPackageId); string frmCaption = dataGridViewX1.Rows[e.RowIndex].Cells["Column1"].Value.ToString() + "—" + dataGridViewX1.Rows[e.RowIndex].Cells["Column2"].Value.ToString() + "—" + dataGridViewX1.Rows[e.RowIndex].Cells["Column4"].Value.ToString(); frmShowGoodsImage frmTmp = new frmShowGoodsImage(imgUrl); frmTmp.Text = frmCaption; frmTmp.Show(this); } else { MessageBox.Show("无有效的物品编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void showPicture(string file) { if (file.IndexOf('\\') == -1) { var webclient = new WebClient(); byte[] buffer = webclient.DownloadData(Properties.Settings.Default["upload"].ToString() + "?filename=" + file); var msg = Encoding.UTF8.GetString(buffer); file = msg.ToString(); } frmShowGoodsImage frmTmp = new frmShowGoodsImage(file); frmTmp.Show(this); }
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.listBox1.IndexFromPoint(e.Location); if (index != System.Windows.Forms.ListBox.NoMatches) { string file = listBox1.Items[index].ToString(); if (file.IndexOf('\\') == -1) { var webclient = new WebClient(); byte[] buffer = webclient.DownloadData(Properties.Settings.Default["upload"].ToString() + "?filename=" + file); var msg = Encoding.UTF8.GetString(buffer); file = msg.ToString(); } //MessageBox.Show(msg.ToString()); frmShowGoodsImage frmTmp = new frmShowGoodsImage(file); frmTmp.Show(this); } }