'Bitmap' could not be found (are you missing a using directive or an assembly reference?)
I am getting the following compile-time error:
The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an assembly reference?)
Here is my code:
BitmapImage img = new BitmapImage();
You have to add System.Drawing to your references so in solution Explorer rightclick on References and click on Add References and in assemblies find System.Drawing and click OK
Add PresentationCore as a reference.
- Click the .NET tab.
- Locate and click the PresentationCore item from the list.
- Click the OK button.
The PresentationCore assembly appears in the References list for your project.
Add a using directive for the System.Windows.Media.Imaging namespace at the top of the file, which is where BitmapImage lives.
using System; using System.Windows.Media.Imaging;
Perhaps you need to add: