Click here to Skip to main content
15,887,135 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: wpf Pin
#realJSOP27-Jul-09 23:49
mve#realJSOP27-Jul-09 23:49 
QuestionPrism, XAP and dynamic loading Pin
User 527145427-Jul-09 8:01
User 527145427-Jul-09 8:01 
AnswerRe: Prism, XAP and dynamic loading Pin
Michael Sync28-Jul-09 4:45
Michael Sync28-Jul-09 4:45 
QuestionHow to draw RichTextBox with mouse? Pin
Farrukhw27-Jul-09 1:13
Farrukhw27-Jul-09 1:13 
AnswerRe: How to draw RichTextBox with mouse? Pin
Christian Graus28-Jul-09 0:10
protectorChristian Graus28-Jul-09 0:10 
GeneralRe: How to draw RichTextBox with mouse? Pin
Farrukhw28-Jul-09 0:22
Farrukhw28-Jul-09 0:22 
GeneralRe: How to draw RichTextBox with mouse? Pin
Christian Graus28-Jul-09 19:27
protectorChristian Graus28-Jul-09 19:27 
QuestionImage loading Pin
#realJSOP26-Jul-09 23:58
mve#realJSOP26-Jul-09 23:58 
I'm writing some code that builds a custom file that combines several additional bits of non-image info along with the image file itself. I can create the file just fine, but when I try to load the file and extract the image from it, I get the following exception from PresentationCore:

The image data generated an overflow during processing.

The inner exception is:

Overflow or underflow in the arithmetic operation.

I load the image as a file stream and saving the resulting array of bytes via serialization. I deserialize to load the file and call this method to retrieve the image (the exception is thrown when it calls Bitmapimage.EndInit()):

//--------------------------------------------------------------------------------
public static BitmapImage BitmapImageFromBytes(byte[] bytes, int desiredX, int desiredY)
{
    BitmapImage  image  = null;
    MemoryStream stream = null;
    try
    {
        stream = new MemoryStream(bytes);
        stream.Seek(0, SeekOrigin.Begin);
        image  = new BitmapImage();
        image.BeginInit();
        image.StreamSource = stream;
image.DecodePixelWidth  = desiredX;
image.DecodePixelHeight = desiredY;
        image.EndInit();
    }
    catch (Exception ex)
    {
        if (ex != null) {}
        throw;
    }
    finally
    {
        stream.Close();
        stream.Dispose();
    }
    return image;
}



"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


AnswerRe: Image loading Pin
Pete O'Hanlon27-Jul-09 2:01
mvePete O'Hanlon27-Jul-09 2:01 
GeneralRe: Image loading Pin
#realJSOP27-Jul-09 23:49
mve#realJSOP27-Jul-09 23:49 
GeneralRe: Image loading Pin
Christian Graus28-Jul-09 0:01
protectorChristian Graus28-Jul-09 0:01 
GeneralRe: Image loading Pin
Pete O'Hanlon28-Jul-09 1:41
mvePete O'Hanlon28-Jul-09 1:41 
GeneralRe: Image loading Pin
#realJSOP28-Jul-09 12:30
mve#realJSOP28-Jul-09 12:30 
GeneralRe: Image loading Pin
Pete O'Hanlon28-Jul-09 21:35
mvePete O'Hanlon28-Jul-09 21:35 
AnswerRe: Image loading Pin
Christian Graus27-Jul-09 23:33
protectorChristian Graus27-Jul-09 23:33 
GeneralRe: Image loading Pin
Jacquers28-Jul-09 0:20
Jacquers28-Jul-09 0:20 
GeneralRe: Image loading Pin
Christian Graus28-Jul-09 11:13
protectorChristian Graus28-Jul-09 11:13 
QuestionParametrize WPF code generator Pin
califax2k26-Jul-09 22:43
califax2k26-Jul-09 22:43 
QuestionCan't find System.ServiceModel.Syndication Pin
Nekkantidivya26-Jul-09 21:50
Nekkantidivya26-Jul-09 21:50 
AnswerRe: Can't find System.ServiceModel.Syndication Pin
Pete O'Hanlon26-Jul-09 22:38
mvePete O'Hanlon26-Jul-09 22:38 
AnswerRe: Can't find System.ServiceModel.Syndication Pin
Pete O'Hanlon27-Jul-09 1:50
mvePete O'Hanlon27-Jul-09 1:50 
Questionselecting iterms from Listbox and displaying in ListView using C#, XAML Pin
Krishna Aditya26-Jul-09 21:01
Krishna Aditya26-Jul-09 21:01 
AnswerRe: selecting iterms from Listbox and displaying in ListView using C#, XAML Pin
Christian Graus26-Jul-09 21:52
protectorChristian Graus26-Jul-09 21:52 
QuestionWPF: Window 7 CustomWindowManager for UserControl [Help] Pin
Kunal Chowdhury «IN»26-Jul-09 20:16
professionalKunal Chowdhury «IN»26-Jul-09 20:16 
AnswerRe: WPF: Window 7 CustomWindowManager for UserControl [Solved] Pin
Kunal Chowdhury «IN»26-Jul-09 21:16
professionalKunal Chowdhury «IN»26-Jul-09 21:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.