Click here to Skip to main content
15,884,629 members
Home / Discussions / C#
   

C#

 
AnswerMessage Closed Pin
30-Mar-16 7:19
mveGerry Schmitz30-Mar-16 7:19 
GeneralRe: Dynamically close DB2 CLP window using C# Pin
Tej_dev30-Mar-16 8:14
Tej_dev30-Mar-16 8:14 
SuggestionRe: Dynamically close DB2 CLP window using C# Pin
Richard Deeming30-Mar-16 8:44
mveRichard Deeming30-Mar-16 8:44 
GeneralMessage Closed Pin
30-Mar-16 8:52
mveGerry Schmitz30-Mar-16 8:52 
GeneralRe: Dynamically close DB2 CLP window using C# Pin
Richard Deeming30-Mar-16 8:54
mveRichard Deeming30-Mar-16 8:54 
AnswerRe: Dynamically close DB2 CLP window using C# Pin
Richard Deeming30-Mar-16 8:52
mveRichard Deeming30-Mar-16 8:52 
GeneralRe: Dynamically close DB2 CLP window using C# Pin
Tej_dev30-Mar-16 9:03
Tej_dev30-Mar-16 9:03 
QuestionBitmap to BitmapImage Conversion Not Working - WPF Pin
AmbiguousName30-Mar-16 4:36
AmbiguousName30-Mar-16 4:36 
Hello. I am using following code to convert bitmap to BitmapImage, in order to show on System.Windows.Control.Image control.
  public BitmapImage ConvertBitmapToBitmapImage(System.Drawing.Bitmap bitmap)
  {
      BitmapImage bitmapImage = null;
      using (var memory = new System.IO.MemoryStream())
      {
          bitmap.Save(memory, System.Drawing.Imaging.ImageFormat.Bmp);
          memory.Position = 0;

          bitmapImage = new BitmapImage();
          bitmapImage.BeginInit();
          bitmapImage.StreamSource = memory;
          bitmapImage.EndInit();

          return bitmapImage;
      }
  }

public void ShowPicture(Bitmap bmp)
{
     pictureBox.Source = ConvertBitmapToBitmapImage(bmp);
     return;
}


It does not throw any exception but it does not show picture as well. When I try to view the picture, it opens up WPF visualizer and shows me some values (properties of BitmapImage), while the bitmap is fine.

What is wrong with my code. Thanks for any input.

This world is going to explode due to international politics, SOON.

AnswerRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
Rob Philpott30-Mar-16 5:46
Rob Philpott30-Mar-16 5:46 
GeneralRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
AmbiguousName30-Mar-16 6:04
AmbiguousName30-Mar-16 6:04 
AnswerRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
Matt T Heffron30-Mar-16 6:54
professionalMatt T Heffron30-Mar-16 6:54 
AnswerRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
Gerry Schmitz30-Mar-16 7:06
mveGerry Schmitz30-Mar-16 7:06 
AnswerRe: Bitmap to BitmapImage Conversion Not Working - WPF Pin
V.31-Mar-16 3:42
professionalV.31-Mar-16 3:42 
Questionworking with pixels Pin
Hira Khalid29-Mar-16 3:16
Hira Khalid29-Mar-16 3:16 
AnswerRe: working with pixels Pin
OriginalGriff29-Mar-16 3:33
mveOriginalGriff29-Mar-16 3:33 
AnswerRe: working with pixels Pin
Dave Kreskowiak29-Mar-16 3:45
mveDave Kreskowiak29-Mar-16 3:45 
AnswerRe: working with pixels Pin
Eddy Vluggen29-Mar-16 4:06
professionalEddy Vluggen29-Mar-16 4:06 
QuestionRe: working with pixels Pin
Richard MacCutchan29-Mar-16 4:25
mveRichard MacCutchan29-Mar-16 4:25 
GeneralRe: working with pixels Pin
harold aptroot29-Mar-16 9:34
harold aptroot29-Mar-16 9:34 
QuestionAccessing unmanaged class from C# Pin
Leif Simon Goodwin29-Mar-16 1:22
Leif Simon Goodwin29-Mar-16 1:22 
QuestionRe: Accessing unmanaged class from C# Pin
Richard MacCutchan29-Mar-16 1:42
mveRichard MacCutchan29-Mar-16 1:42 
AnswerRe: Accessing unmanaged class from C# Pin
Leif Simon Goodwin29-Mar-16 4:17
Leif Simon Goodwin29-Mar-16 4:17 
GeneralRe: Accessing unmanaged class from C# Pin
Richard MacCutchan29-Mar-16 4:32
mveRichard MacCutchan29-Mar-16 4:32 
GeneralRe: Accessing unmanaged class from C# Pin
Leif Simon Goodwin29-Mar-16 5:10
Leif Simon Goodwin29-Mar-16 5:10 
AnswerRe: Accessing unmanaged class from C# Pin
Garth J Lancaster29-Mar-16 1:47
professionalGarth J Lancaster29-Mar-16 1:47 

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.