FrmDatos y FrmExec: Corregir carga de imágenes

This commit is contained in:
2013-11-26 23:22:35 +01:00
parent 9940c5dcb9
commit 0ab98aef0e
3 changed files with 13 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ namespace ServerExplorer.UI
{ {
if (e.DesiredType == typeof(Image)) 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); e.Value = new Bitmap(1, 1);
} }

View File

@@ -73,6 +73,7 @@
this.dgvDatos.Name = "dgvDatos"; this.dgvDatos.Name = "dgvDatos";
this.dgvDatos.Size = new System.Drawing.Size(604, 338); this.dgvDatos.Size = new System.Drawing.Size(604, 338);
this.dgvDatos.TabIndex = 2; this.dgvDatos.TabIndex = 2;
this.dgvDatos.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvDatos_CellFormatting);
// //
// splitContainer1 // splitContainer1
// //

View File

@@ -144,6 +144,17 @@ namespace ServerExplorer.UI
dgvDatos.DataSource = ddt; 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);
}
}
}
} }