private void ShowImage() { if (dataGridView1.CurrentRow != null) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } SalesQuantityRanking item = (SalesQuantityRanking)dataGridView1.CurrentRow.DataBoundItem; if (skinCheckBoxShowImage.Checked) { if (imageCtrl != null) { imageCtrl?.Close(); imageCtrl = null; } imageCtrl = new SingleImageForm(); imageCtrl.FormClosing += ImageCtrl_FormClosing; imageCtrl.Text = "款号:" + item.CostumeID; skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged; skinCheckBoxShowImage.Checked = true; skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged; imageCtrl.OnLoadingState(); Costume Curitem = CommonGlobalCache.GetCostume(item.CostumeID); // byte[] bytes = CommonGlobalCache.ServerProxy.GetCostumePhoto(item.CostumeID); if (Curitem.EmThumbnail != null) { // imageCtrl.Image = CCWin.SkinControl.ImageHelper.Convert(bytes); System.Net.WebRequest webreq = System.Net.WebRequest.Create(Curitem.EmThumbnail); System.Net.WebResponse webres = webreq.GetResponse(); using (System.IO.Stream stream = webres.GetResponseStream()) { imageCtrl.Image = Image.FromStream(stream); } } else { imageCtrl.Image = null; } imageCtrl?.BringToFront(); imageCtrl?.Show(); } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } } }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { DataGridView view = (DataGridView)sender; DataGridViewRow row = view.CurrentRow; if (row != null && row.Index != -1 && row != currRow) { currRow = row; SalesQuantityRanking ranking = (SalesQuantityRanking)dataGridView1.CurrentRow.DataBoundItem; if (showSelection) { if (RowSelected != null) { this.skinSplitContainer1.Panel2Collapsed = false; RowSelected.Invoke(ranking, this.pagePara, this.skinSplitContainer1.Panel2); } } try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } if (skinCheckBoxShowImage.Checked) { if (imageCtrl != null) { imageCtrl?.Close(); imageCtrl = null; } imageCtrl = new SingleImageForm(); imageCtrl.FormClosing += ImageCtrl_FormClosing; imageCtrl.Text = "款号:" + ranking.CostumeID; imageCtrl.OnLoadingState(); skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged; skinCheckBoxShowImage.Checked = true; skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged; Costume Curitem = CommonGlobalCache.GetCostume(ranking.CostumeID); // byte[] bytes = CommonGlobalCache.ServerProxy.GetCostumePhoto(ranking.CostumeID); if (Curitem.EmThumbnail != null) { System.Net.WebRequest webreq = System.Net.WebRequest.Create(Curitem.EmThumbnail); System.Net.WebResponse webres = webreq.GetResponse(); using (System.IO.Stream stream = webres.GetResponseStream()) { imageCtrl.Image = Image.FromStream(stream); } // imageCtrl.Image = CCWin.SkinControl.ImageHelper.Convert(bytes); } else { imageCtrl.Image = null; } imageCtrl?.BringToFront(); imageCtrl?.Show(); } } catch (Exception ex) { // ShowError(ex); } finally { UnLockPage(); } } }