PDA

View Full Version : .Net Picturebox Image Property



Unregistered
June 2, 2004, 18:38:34
Anyone know of a way I can copy the ImagingControl Picture Property to the Picturebox picture property?

Since .Net does not have a picture property, I've not been able to work around this yet.

Thanks,
Keith

Stefan Geissler
June 3, 2004, 13:43:53
Hello.

I suggest to use the GetDib() method of IC Imaging Control, try to convert it to a .NET Bitmap and use the Graphic object of the PictureBox to draw the Bitmap. I have searched the MSDN but found only the known GDI function SetDIBits to handle DIBs.

Stefan Geissler
June 8, 2004, 12:16:24
Hello,

Here is a simple solution:

In ImageAvailalbe event:



Private Sub AxICImagingControl1_ImageAvailable(ByVal sender As Object, ByVal e As
AxICImagingControl._IICImagingControlEvents_ImageA vailableEvent) Handles
AxICImagingControl1.ImageAvailable
Dim pic As stdole.Picture
pic = AxICImagingControl1.ImageBuffers(0).Picture
PictureBox1.Image = Image.FromHbitmap(New IntPtr(pic.Handle))
End Sub


Or simply MemorySnapImage:


Dim pic As stdole.Picture
AxICImagingControl1.MemorySnapImage()
pic = AxICImagingControl1.Picture
PictureBox1.Image = Image.FromHbitmap(New IntPtr(pic.Handle))