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) { if (dataGridView1.CurrentRow != null) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } DataRowView item = (DataRowView)dataGridView1.CurrentRow.DataBoundItem; if (curCostume != item && skinCheckBoxShowImage.Checked) { if (imageCtrl != null) { imageCtrl?.Close(); imageCtrl = null; } imageCtrl = new SingleImageForm(); imageCtrl.FormClosing += ImageCtrl_FormClosing; imageCtrl.Text = "款号:" + item["CostumeID"]; imageCtrl.OnLoadingState(); skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged; skinCheckBoxShowImage.Checked = true; skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged; byte[] bytes = CommonGlobalCache.ServerProxy.GetCostumePhoto(item["CostumeID"].ToString()); if (bytes != null) { imageCtrl.Image = CCWin.SkinControl.ImageHelper.Convert(bytes); } else { imageCtrl.Image = null; } imageCtrl?.BringToFront(); imageCtrl?.Show(); curCostume = item; } } catch (Exception ex) { // ShowError(ex); } finally { UnLockPage(); } } }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null && dataGridView1.Rows.Count > 0) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } List <CostumeStore> dt = DataGridViewUtil.BindingListToList <CostumeStore>(dataGridView1.DataSource); if (dt.Count > 0 && this.dataGridView1.CurrentRow.DataBoundItem != null) { CostumeStore item = (CostumeStore)dataGridView1.CurrentRow.DataBoundItem; if (curCostume != item && skinCheckBoxShowImage.Checked) { if (imageCtrl != null) { imageCtrl?.Close(); imageCtrl = null; } skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged; skinCheckBoxShowImage.Checked = true; skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged; imageCtrl = new SingleImageForm(); imageCtrl.FormClosing += ImageCtrl_FormClosing; imageCtrl.Text = "款号:" + item.CostumeID; imageCtrl.OnLoadingState(); Costume Curitem = CommonGlobalCache.GetCostume(item.CostumeID); // byte[] bytes = CommonGlobalCache.ServerProxy.GetCostumePhoto(item.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(); curCostume = item; } // dataGridView1.CurrentRow.Index = -1; } } catch (Exception ex) { // ShowError(ex); } finally { UnLockPage(); } } }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } DataRowView item = (DataRowView)dataGridView1.CurrentRow.DataBoundItem; if (curCostume != item && skinCheckBoxShowImage.Checked) { if (imageCtrl != null) { imageCtrl?.Close(); imageCtrl = null; } imageCtrl = new SingleImageForm(); imageCtrl.FormClosing += ImageCtrl_FormClosing; imageCtrl.Text = "款号:" + item["CostumeID"]; imageCtrl.OnLoadingState(); skinCheckBoxShowImage.CheckedChanged -= skinCheckBoxShowImage_CheckedChanged; skinCheckBoxShowImage.Checked = true; skinCheckBoxShowImage.CheckedChanged += skinCheckBoxShowImage_CheckedChanged; Costume cItem = CommonGlobalCache.GetCostume(item["CostumeID"].ToString()); if (cItem.EmThumbnail != "") { String url = cItem.EmThumbnail; System.Net.WebRequest webreq = System.Net.WebRequest.Create(url); System.Net.WebResponse webres = webreq.GetResponse(); using (System.IO.Stream stream = webres.GetResponseStream()) { imageCtrl.Image = Image.FromStream(stream); } } else { imageCtrl.Image = null; } /* byte[] bytes = CommonGlobalCache.ServerProxy.GetCostumePhoto(item["CostumeID"].ToString()); * if (bytes != null) * { * imageCtrl.Image = CCWin.SkinControl.ImageHelper.Convert(bytes); * } * else * { * imageCtrl.Image = null; * }*/ imageCtrl?.BringToFront(); imageCtrl?.Show(); curCostume = item; } } 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(); } } }