View Full Version : ImageActiveBuffer.Bitmap, C# 2008

March 15, 2009, 14:01:16

I am using the ICImagingControl under Visual Studio 2008 (C#) and Windows XP Professional SP2.

I am trying to capture a single image usiong the Image Acquisition: Acquiring an Image sample code. It seems that icImagingControl1.ImageActiveBuffer.Bitmap does not exist.
I tried using axICImagingControl1.ImageActiveBuffer.Picture, but it doesn't terurn a bitmap. I get the message: "Error: Cannot implicitly convert type 'object' to 'System.Drawing.Bitmap'."

When using (System.Drawing.Bitmap)axICImagingControl1.ImageAc tiveBuffer.Picture I get "Unable to cast COM object of type 'System.__ComObject' to class type 'System.Drawing.Bitmap'."

Please advise

Stefan Geissler
March 16, 2009, 11:24:38

I used following code

System.Drawing.Bitmap Bmp = icImagingControl1.ImageActiveBuffer.Bitmap;
Bmp.Save("c:\\test.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
It worked fine on my computer.

You are sure, that all needed references are include in your project:

March 16, 2009, 13:36:37
AxInterop.ICImagingControl3.dll and Interop.ICImagingControl3.dll are referenced. I was not able to find the other two on my computer.

"Bitmap" is not recognized. It gives an error: "'ICImagingControl3.ImageBuffer' does not contain a definition for 'Bitmap' and no extension method 'Bitmap' accepting a first argument of type 'ICImagingControl3.ImageBuffer' could be found".

By the way, the control is called axICImagingControl1 by default. Does it mean anything?

Stefan Geissler
March 16, 2009, 14:10:00
Well, one of the not found other two is the important: "ImagingControl3.dll" this is the control itself. Also please have a look into your project references, not on your hardddisc, whether the files exist.

By the way, the control is called axICImagingControl1 by default. Does it mean anything?
Edit/Delete Message

Oh yes. It means, you imported an ActiveX control used for VB6. You did not import the .NET control as mentioned in the documentation. This clearly explains, why you have not System.Drawing.Bitmap object. VB6 simply did not know anything about this.

Please use the IC.NET control in .NET project. Do not use the ActiveX control!
(Even it is shown for VS 2003, the steps are nearly similar)

March 16, 2009, 16:31:45
Thanks. That solved the problem. Apparently only the VB component was installed.