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

WPF

 
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 
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 
Try using this method instead:
public static BitmapImage BitmapImageFromBytes(byte[] bytes) 
{ 
  BitmapImage image = null; 
  MemoryStream stream = null; 
  try { 
    stream = new MemoryStream(bytes); 
    stream.Seek(0, SeekOrigin.Begin);
    System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
    image = new BitmapImage(); 
    image.BeginInit();
    MemoryStream ms = new MemoryStream();
    img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
    ms.Seek(0, SeekOrigin.Begin);
    image.StreamSource = ms;
    //image.StreamSource = stream; 
    //image.DecodePixelWidth = desiredX; 
    //image.DecodePixelHeight = desiredY; 
    image.StreamSource.Seek(0, SeekOrigin.Begin);
    image.EndInit(); 
  } 
  catch (Exception ex) 
  { 
    if (ex != null) 
    { 
    } 
    throw; 
  } 
  finally { 
    stream.Close(); 
    stream.Dispose(); 
  } 
  return image; 
}
This requires you to import System.Drawing, but it does the job.

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



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 
QuestionListView selecteditem Pin
Jacob Dixon26-Jul-09 15:23
Jacob Dixon26-Jul-09 15:23 
QuestionProblems Merging a MediaPlayer SL2Gallery Template into an Existing SL 2 App Pin
SBJ26-Jul-09 7:50
SBJ26-Jul-09 7:50 
AnswerRe: Problems Merging a MediaPlayer SL2Gallery Template into an Existing SL 2 App Pin
Michael Sync28-Jul-09 6:04
Michael Sync28-Jul-09 6:04 
GeneralRe: Problems Merging a MediaPlayer SL2Gallery Template into an Existing SL 2 App Pin
SBJ28-Jul-09 12:32
SBJ28-Jul-09 12:32 

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.