From 0ab98aef0e543cae780aa923614b9b90a2d2ccfe Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Tue, 26 Nov 2013 23:22:35 +0100 Subject: [PATCH] =?UTF-8?q?FrmDatos=20y=20FrmExec:=20Corregir=20carga=20de?= =?UTF-8?q?=20im=C3=A1genes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ServerExplorer/UI/FrmDatos.cs | 2 +- ServerExplorer/UI/FrmExec.Designer.cs | 1 + ServerExplorer/UI/FrmExec.cs | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ServerExplorer/UI/FrmDatos.cs b/ServerExplorer/UI/FrmDatos.cs index 362349d..c10dc4a 100644 --- a/ServerExplorer/UI/FrmDatos.cs +++ b/ServerExplorer/UI/FrmDatos.cs @@ -33,7 +33,7 @@ namespace ServerExplorer.UI { if (e.DesiredType == typeof(Image)) { - if (e.Value is DBNull || ((byte[])e.Value).Length <= 0) + if (e.Value is DBNull || (e.Value is byte[] && ((byte[])e.Value).Length <= 0)) { e.Value = new Bitmap(1, 1); } diff --git a/ServerExplorer/UI/FrmExec.Designer.cs b/ServerExplorer/UI/FrmExec.Designer.cs index 47221ca..aff03f5 100644 --- a/ServerExplorer/UI/FrmExec.Designer.cs +++ b/ServerExplorer/UI/FrmExec.Designer.cs @@ -73,6 +73,7 @@ this.dgvDatos.Name = "dgvDatos"; this.dgvDatos.Size = new System.Drawing.Size(604, 338); this.dgvDatos.TabIndex = 2; + this.dgvDatos.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvDatos_CellFormatting); // // splitContainer1 // diff --git a/ServerExplorer/UI/FrmExec.cs b/ServerExplorer/UI/FrmExec.cs index f764ce8..e0f6b01 100644 --- a/ServerExplorer/UI/FrmExec.cs +++ b/ServerExplorer/UI/FrmExec.cs @@ -144,6 +144,17 @@ namespace ServerExplorer.UI dgvDatos.DataSource = ddt; } + private void dgvDatos_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) + { + if (e.DesiredType == typeof(Image)) + { + if (e.Value is DBNull || (e.Value is byte[] && ((byte[])e.Value).Length <= 0)) + { + e.Value = new Bitmap(1, 1); + } + } + } + }