title: wpf - Can i use System.Drawing in wpf?
body: <p>i am saving the image in database. .. but how to retrieve that image from database .. when i try to use system.drawing .. it shows an error .. some of ppl saying i can't use system.drwaing in wpf .. not even dll file ..</p>
  
  <p>my code is </p>
  
  <pre><code>private void btnShow_Click(object sender, RoutedEventArgs e)
  {
         DataTable dt2 =  reqBll.SelectImage().Tables[0];
         byte[] data = (byte[])dt2.Rows[0][1];
         MemoryStream strm = new MemoryStream();
         strm.Write(data, 0, data.Length);
         strm.Position = 0;
         System.Drawing.Image img = System.Drawing.Image.FromStream(strm);
         BitmapImage bi = new BitmapImage();
         bi.BeginInit();
         MemoryStream ms = new MemoryStream();
         img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
         ms.Seek(0, SeekOrigin.Begin);
         bi.StreamSource = ms;
         bi.EndInit();
         ImgBox.Source = bi;
      }
  </code></pre>
  
  <p>what to do now?</p>
  
  <p>i used the system.drawing.dll .. now i can use system.drawing.bitmap .. but after using it shows an error at System.Drawing.Image.FromStream(strm);</p>
  
  <p>error:-  argument exception was unhandled by user code </p>
  
  <p>Parameter is not valid.</p>