This is a migrated thread and some comments may be shown as answers.

Picturebox problem

6 Answers 574 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joe Cody
Top achievements
Rank 1
Joe Cody asked on 15 Oct 2010, 05:21 PM
If I create a blank report, add a picturebox control, set the value to point to a JPG file (logo in this case) and then try to preview either in VS or with a test page using the viewer control, I get this error (numerous times):

Code generation for property 'Value' failed. A generic error occuered in GDI+.

Anybody have any ideas? The error was discovered on a more complex report but in testing it I discovered I could reproduce it with a blank/empty report. Any help or sugestions would be appreciated.

Thanks

6 Answers, 1 is accepted

Sort by
0
Joe Cody
Top achievements
Rank 1
answered on 15 Oct 2010, 05:40 PM
So, I saved the JPG to a PNG file format and the error does NOT occur, however, the PNG file does not react appropriately to the "sizing" property. In the designer it does, but when viewing it seems to ignore the property....???
0
Steve
Telerik team
answered on 19 Oct 2010, 04:00 PM
Hi Joe Cody,

As we were unable to reproduce such problem on our end, we would appreciate if you provide us with the problematic image (both JPG and PNG) and we would be able to advise you once we investigate what is causing the problem.

Best wishes,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Joe Cody
Top achievements
Rank 1
answered on 22 Oct 2010, 10:01 PM
Thanks for the response...it seems the problem is with the JPG file itself. We converted it to GIF as a test using GIMP and it displayed properly in the picturebox.

Thanks again
0
Przemyslaw
Top achievements
Rank 1
answered on 22 Nov 2010, 10:43 PM
Hi, I have same problem. I loading .jpg image from MSSQL database "image column" data and I have GDI+ Error.. It works for .png images and when I set .jpg image manually from local file. Any ideas?

Thanks for Your help.


byte[] bimg = ... loaded from DB
Image img = null;
using(MemoryStream ms = new MemoryStream(bimg))
{
img = Image.FromStream(ms);
}
pictureBox.Value = img; //GDI+ error
0
Przemyslaw
Top achievements
Rank 1
answered on 22 Nov 2010, 11:21 PM
ok, I found a solution to the problem. The solution described here:

http://support.microsoft.com/?id=814675

Image CopyImage(Image original)
{
    Image ret = new Bitmap(original.Width, original.Height);
    using(Graphics g = Graphics.FromImage(ret))
    {
        g.DrawImage(original, 0, 0, original.Width, original.Height);
        g.Save();
    }
    return ret;
}
 
And finally....
 
pictureBox.Value = CopyImage(img);


But... I have a problem with copying text
from VS, notepad etc. to Reply Form...
Font size is veeerrry small (in Chrome)



0
richard
Top achievements
Rank 1
answered on 06 Mar 2014, 08:36 PM
i know this is a few years old but it saved my bacon working with Azure....
Tags
General Discussions
Asked by
Joe Cody
Top achievements
Rank 1
Answers by
Joe Cody
Top achievements
Rank 1
Steve
Telerik team
Przemyslaw
Top achievements
Rank 1
richard
Top achievements
Rank 1
Share this question
or